common package#
Submodules#
common.Browser module#
- class common.Browser.Browser(parent=None, help_mapping={}, base_path='')[source]#
Bases:
QDockWidgetA collection of browser related methods.
- Parameters:
- eventFilter :
event filter used to select help page.
- open_browser :
Opens a web browser for use in LaME
- go_to_home :
Returns to project homepage.
- go_to_page :
Loads location typed into the file line edit field.
- Raises:
TypeError : – Parent must be an instance of QMainWindow
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)allowedAreas(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, event)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(obj, event)Event filter to capture mouse press and hover events
features(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)The browser returns to the documentation index.html file
go_to_page([location])Tries to load the page given in
MainWindow.browser_locationgrab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAreaAllowed(self, area)isEnabled(self)isEnabledTo(self, a0)isFloating(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)Creates and opens a browser in the bottom tabWidget
overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, event)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllowedAreas(self, areas)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFeatures(self, features)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFloating(self, floating)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTitleBarWidget(self, widget)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWidget(self, widget)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)titleBarWidget(self)toggleViewAction(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockWidgetFeature
PaintDeviceMetric
RenderFlag
allowedAreasChanged
customContextMenuRequested
destroyed
dockLocationChanged
featuresChanged
objectNameChanged
topLevelChanged
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- eventFilter(obj, event)[source]#
Event filter to capture mouse press and hover events
If help mode is active, handles mouse clicks to open help or changes cursor on hover.
- Parameters:
obj (QObject) – The widget the event occurred on.
event (QEvent) – The event being filtered.
- Returns:
Trueif the event was handled, otherwiseFalse.- Return type:
- class common.Browser.WebEngineView(parent=None)[source]#
Bases:
QWebEngineViewCreates a web engine widget to display user guide
_extended_summary_
- Parameters:
QWebEngineView (QWebEngine) – A web engine widget
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)back(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createStandardContextMenu(self)createWindow(self, type)createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, e)dragLeaveEvent(self, e)dragMoveEvent(self, e)dropEvent(self, e)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)findText(self, subString[, options, ...])focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)forPage(page)foregroundRole(self)forward(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasSelection(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)history(self)icon(self)iconUrl(self)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)lastContextMenuRequest(self)layout(self)layoutDirection(self)leaveEvent(self, a0)load(load)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)on_load_finished(success)Executes after page loading is complete
on_load_progress(progress)Adds a loading progress message to the MainWindow.statusBar
Executes when page starts to load.
overrideWindowFlags(self, type)overrideWindowState(self, state)page(self)pageAction(self, action)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)print(self, printer)printToPdf(, QPageLayout.Portrait, ...)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)reload(self)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)selectedText(self)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContent(self, data[, mimeType, baseUrl])setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setHtml(self, html[, baseUrl])setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPage(self, page)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setUrl(self, url)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)setZoomFactor(self, factor)settings(self)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)Displays 404 error page.
signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)stop(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)title(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])triggerPageAction(self, action[, checked])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)url(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)zoomFactor(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
handle_console_message
iconChanged
iconUrlChanged
loadFinished
loadProgress
loadStarted
objectNameChanged
pdfPrintingFinished
printFinished
printRequested
printRequestedByFrame
renderProcessTerminated
selectionChanged
titleChanged
urlChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- on_load_finished(success)[source]#
Executes after page loading is complete
- Parameters:
success (bool) – Runs upon load
common.Calculator module#
- class common.Calculator.CalculatorDock(ui=None, filename=None)[source]#
Bases:
CustomDockWidget,FieldLogicUICreates a CustomFieldCalculator with UI controls inside a dock widget that can be added to a QMainWindow
- Parameters:
- Returns:
_description_
- Return type:
_type_
- Raises:
TypeError – Parent must be an instance of QMainWindow.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)allowedAreas(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)Adds the selected field to the calculator
Deletes a previously stored formula
Loads the help webpage associated with the calculator in the Help tab
calc_insert_function(func_name)Inserts a func_name into the calculator
calc_insert_operator(operator)Inserts an operator into the calculator
Loads saved calculated fields
Loads a predefined formula to use in the calculator
Sets whether to add a new function
calculate_new_field([save])Calculates a new field from
CalculatorDock.calc_text_editand updates UIchangeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Override the default close event to hide the dock widget instead of closing it.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)features(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAreaAllowed(self, area)isEnabled(self)isEnabledTo(self, a0)isFloating(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, event)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllowedAreas(self, areas)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFeatures(self, features)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFloating(self, floating)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTitleBarWidget(self, widget)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWidget(self, widget)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)titleBarWidget(self)toggleViewAction(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])update_data(data)Updates the data
update_field_combobox(parentBox, childBox, ...)Updates comboBoxes with fields for plots or analysis
update_field_type_combobox(comboBox[, ...])Updates field type combobox
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockWidgetFeature
PaintDeviceMetric
RenderFlag
allowedAreasChanged
connect_logger
connect_widgets
customContextMenuRequested
destroyed
dockLocationChanged
featuresChanged
objectNameChanged
setupUI
topLevelChanged
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- calc_add_field()[source]#
Adds the selected field to the calculator
Adds the selected field as
{field_type.field}. If the field is normalized, a_Nis added to the end of the field name, i.e.,{field_type.field_N}.
- calc_delete_formula()[source]#
Deletes a previously stored formula
Removes the formula from
MainWindow.formula_combobox, the file given byMainWindow.calc_filenameandparent.app_data.data[parent.app_data.sample_id].processed_data.
- calc_insert_function(func_name)[source]#
Inserts a func_name into the calculator
When the user pushes a function button on the calculator, operator is inserted into
MainWindow.calc_text_edit. Thecase()function inserts(cond, expr)as both a condition and expression are required to compute.- Parameters:
operator (str) – Inserts operators from calculator
- calc_insert_operator(operator)[source]#
Inserts an operator into the calculator
When the user pushes an operator button on the calculator, operator is inserted into
MainWindow.calc_text_edit.- Parameters:
operator (str) – Inserts operators from calculator
- calc_load_dict()[source]#
Loads saved calculated fields
Loads the file saved in
self.calc_filename, unless the file is overridden by user preferences. The file should be formatted as name: expression. The expression may contain mulitple case(cond, expr) separated by a;.
- calc_set_add_formula()[source]#
Sets whether to add a new function
Sets
MainWindow.add_formulatoTrue, a flag used byMainWindow.calculate_new_fieldto determine whether to add an item toMainWindow.formula_combobox.
- calculate_new_field(save=False)[source]#
Calculates a new field from
CalculatorDock.calc_text_editand updates UIWhen
CalculatorDock.toolButtonCalculateis clicked, …If
save == True, the formula toresources/app_data/calculator.txtfile so it can be recalled and used at a future time or in another sample. PushingCalculatorDock.toolButtonCalcSave, opens a dialog prompting the user to input the name for the newly calculated field.- Parameters:
data (AttributeDataFrame) – Data used to compute custom field
save (bool, optional) – Determines whether to save upon successful calculation, by default
False
- closeEvent(event)#
Override the default close event to hide the dock widget instead of closing it.
This prevents the widget from being destroyed and allows it to be shown again later via widget.show().
- Parameters:
event (QEvent) – The close event triggered by the user action.
- update_data(data)#
Updates the data
- Parameters:
data (AttributeDataFrame) – New data frame
- update_field_combobox(parentBox, childBox, *args, **kwargs)#
Updates comboBoxes with fields for plots or analysis
Updates lists of fields in comboBoxes that are used to generate plots or used for analysis. Calls
MainWindow.get_field_list()to construct the list.- Parameters:
parentBox (QComboBox, None) – ComboBox used to select field type (‘Analyte’, ‘Analyte (normalized)’, ‘Ratio’, etc.), if None, then ‘Analyte’
childBox (QComboBox) – ComboBox with list of field values
- update_field_type_combobox(comboBox, addNone=False, plot_type='')#
Updates field type combobox
Used to update
MainWindow.comboBoxHistFieldType,MainWindow.comboBoxFilterFieldType,MainWindow.comboBoxFieldTypeX,MainWindow.comboBoxFieldTypeY,MainWindow.comboBoxFieldTypeZ, andMainWindow.comboBoxColorByField
- class common.Calculator.CustomFieldCalculator[source]#
Bases:
objectMethods
calc_evaluate_expr(expr[, val_dict, keep])Evaluates an expression and returns the result
calc_parse(data, ref_chem[, txt])Prepares expression for calculating a custom field
calculate_new_field(data, ref_chem, new_field)Calculates a new field from
MainWindow.calc_text_edit- calc_evaluate_expr(expr, val_dict=None, keep=None)[source]#
Evaluates an expression and returns the result
- Parameters:
expr (string) – Expression to be evaluated. The expression can be a conditional expression, which results in returning a np.ndarray of bool, otherwise, generally np.ndarray of float
val_dict (dict) – Dictionary with variable names as the key and values taken from the data, generally np.ndarray, by default
Nonekeep (np.ndarray of bool or None, optional) – An array of True/False values that are used to evaluate the expression of limited values, i.e., generally when cases are involved.
- Returns:
Result of evaluated expression.
- Return type:
- calc_parse(data, ref_chem, txt=None)[source]#
Prepares expression for calculating a custom field
Parses
MainWindow.calc_text_editto produce an expression that can be evaluated.- Parameters:
data (AttributeDataFrame) – Data used to compute custom field
ref_chem (pandas.DataFrame) – Reference chemistry used when normalization is required
txt (str)
- Returns:
returns the conditional (cond) and expression (expr)
- Return type:
- calculate_new_field(data, ref_chem, new_field)[source]#
Calculates a new field from
MainWindow.calc_text_editWhen
MainWindow.toolButtonCalculateis clicked, …If
save == True, the formula toresources/app_data/calculator.txtfile so it can be recalled and used at a future time or in another sample. PushingMainWindow.toolButtonCalcSave, opens a dialog prompting the user to input the name for the newly calculated field.- Parameters:
data (AttributeDataFrame) – Data used to compute custom field
new_field (str) – Name of new field to be computed
common.CodingWidgets module#
- class common.CodingWidgets.CodeEditor(parent=None)[source]#
Bases:
QPlainTextEdit- Attributes:
- highlight_line
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addScrollBarWidget(self, widget, alignment)adjustSize(self)anchorAt(self, pos)appendHtml(self, html)appendPlainText(self, text)autoFillBackground(self)backgroundRole(self)backgroundVisible(self)baseSize(self)blockBoundingGeometry(self, block)blockBoundingRect(self, block)blockCount(self)blockSignals(self, b)canInsertFromMimeData(self, source)canPaste(self)centerCursor(self)centerOnScroll(self)changeEvent(self, e)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clear(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentOffset(self)contentsMargins(self)contentsRect(self)contextMenuEvent(self, e)contextMenuPolicy(self)copy(self)cornerWidget(self)create(self[, window, initializeWindow, ...])createMimeDataFromSelection(self)createStandardContextMenu(-> Optional[QMenu])createWindowContainer(window[, parent, flags])currentCharFormat(self)cursor(self)cursorForPosition(self, pos)cursorRect(-> QRect)cursorWidth(self)customEvent(self, a0)cut(self)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)document(self)documentTitle(self)dragEnterEvent(self, e)dragLeaveEvent(self, e)dragMoveEvent(self, e)drawFrame(self, a0)dropEvent(self, e)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensureCursorVisible(self)ensurePolished(self)enterEvent(self, event)event(self, e)eventFilter(self, a0, a1)extraSelections(self)find() -> bool ))findChild(-> QObjectT)findChildren(...)firstVisibleBlock(self)focusInEvent(self, e)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, e)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameRect(self)frameShadow(self)frameShape(self)frameSize(self)frameStyle(self)frameWidth(self)geometry(self)getPaintContext(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)horizontalScrollBar(self)horizontalScrollBarPolicy(self)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(-> Any)insertAction(self, before, action)insertActions(self, before, actions)insertFromMimeData(self, source)insertPlainText(self, text)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isReadOnly(self)isRightToLeft(self)isSignalConnected(self, signal)isUndoRedoEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, e)keyReleaseEvent(self, e)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)lineWidth(self)lineWrapMode(self)loadResource(self, type, name)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumBlockCount(self)maximumHeight(self)maximumSize(self)maximumViewportSize(self)maximumWidth(self)mergeCurrentCharFormat(self, modifier)metaObject(self)metric(self, a0)midLineWidth(self)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, e)mouseGrabber()mouseMoveEvent(self, e)mousePressEvent(self, e)mouseReleaseEvent(self, e)move(move)moveCursor(self, operation[, mode])moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)overwriteMode(self)paintEngine(self)paintEvent(self, e)paintingActive(self)palette(self)parent(self)parentWidget(self)paste(self)physicalDpiX(self)physicalDpiY(self)placeholderText(self)pos(self)previousInFocusChain(self)print(self, printer)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)redo(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, e)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)scrollBarWidgets(self, alignment)scrollContentsBy(self, dx, dy)selectAll(self)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBackgroundVisible(self, visible)setBaseSize(setBaseSize)setCenterOnScroll(self, enabled)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCornerWidget(self, widget)setCurrentCharFormat(self, format)setCursor(self, a0)setCursorWidth(self, width)setDisabled(self, a0)setDocument(self, document)setDocumentTitle(self, title)setEnabled(self, a0)setExtraSelections(self, selections)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrameRect(self, a0)setFrameShadow(self, a0)setFrameShape(self, a0)setFrameStyle(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setHorizontalScrollBar(self, scrollbar)setHorizontalScrollBarPolicy(self, a0)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLineWidth(self, a0)setLineWrapMode(self, mode)setLocale(self, locale)setMask(setMask)setMaximumBlockCount(self, maximum)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMidLineWidth(self, a0)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setOverwriteMode(self, overwrite)setPalette(self, a0)setParent(setParent)setPlaceholderText(self, placeholderText)setPlainText(self, text)setProperty(self, name, value)setReadOnly(self, ro)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeAdjustPolicy(self, policy)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabChangesFocus(self, b)setTabOrder(a0, a1)setTabStopDistance(self, distance)setTabletTracking(self, enable)setTextCursor(self, cursor)setTextInteractionFlags(self, flags)setToolTip(self, a0)setToolTipDuration(self, msec)setUndoRedoEnabled(self, enable)setUpdatesEnabled(self, enable)setVerticalScrollBar(self, scrollbar)setVerticalScrollBarPolicy(self, a0)setViewport(self, widget)setViewportMargins(setViewportMargins)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)setWordWrapMode(self, policy)setupViewport(self, viewport)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeAdjustPolicy(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabChangesFocus(self)tabStopDistance(self)tabletEvent(self, a0)testAttribute(self, attribute)textCursor(self)textInteractionFlags(self)thread(self)timerEvent(self, e)toPlainText(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)undo(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)verticalScrollBar(self)verticalScrollBarPolicy(self)viewport(self)viewportEvent(self, a0)viewportMargins(self)viewportSizeHint(self)visibleRegion(self)whatsThis(self)wheelEvent(self, e)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)wordWrapMode(self)x(self)y(self)zoomIn(self[, range])zoomOut(self[, range])LineWrapMode
PaintDeviceMetric
RenderFlag
Shadow
Shape
SizeAdjustPolicy
StyleMask
blockCountChanged
copyAvailable
cursorPositionChanged
customContextMenuRequested
destroyed
highlightCurrentLine
lineNumberAreaPaintEvent
lineNumberAreaWidth
load_all_settings
modificationChanged
objectNameChanged
open_highlight_dialog
open_settings_dialog
redoAvailable
repeat_heading_char
save_all_settings
selectionChanged
setHighlighter
textChanged
toggle_highlighter
undoAvailable
updateLineNumberArea
updateLineNumberAreaWidth
updateRequest
update_font
update_font_size
windowIconChanged
windowIconTextChanged
windowTitleChanged
- property highlight_line#
- class common.CodingWidgets.CodeEditorMenu(editor: CodeEditor, menu_bar: QMenuBar)[source]#
Bases:
object
- class common.CodingWidgets.CodeEditorToolbar(editor: CodeEditor, toolbar: QToolBar)[source]#
Bases:
object
- class common.CodingWidgets.EditorSettingsDialog(settings, default_settings, editor=None)[source]#
Bases:
QDialogMethods
accept(self)acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)done(self, a0)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)exec(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isSizeGripEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)open(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)reject(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)result(self)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModal(self, modal)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setResult(self, r)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeGripEnabled(self, a0)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DialogCode
PaintDeviceMetric
RenderFlag
accepted
customContextMenuRequested
destroyed
finished
objectNameChanged
rejected
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CodingWidgets.HighlightRulesDialog(rules, parent=None)[source]#
Bases:
QDialogMethods
accept(self)acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)done(self, a0)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)exec(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isSizeGripEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)open(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)reject(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)result(self)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModal(self, modal)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setResult(self, r)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeGripEnabled(self, a0)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DialogCode
PaintDeviceMetric
RenderFlag
accepted
choose_bg_color
choose_color
choose_text_color
customContextMenuRequested
destroyed
finished
load_rule
objectNameChanged
open_highlight_dialog
rejected
save_rule
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CodingWidgets.LineNumberArea(editor)[source]#
Bases:
QWidgetMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CodingWidgets.RstHighlighter(editor, enable, rules=None)[source]#
Bases:
QSyntaxHighlighterMethods
blockSignals(self, b)childEvent(self, a0)children(self)connectNotify(self, signal)currentBlock(self)currentBlockState(self)currentBlockUserData(self)customEvent(self, a0)deleteLater(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)document(self)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)event(self, a0)eventFilter(self, a0, a1)findChild(-> QObjectT)findChildren(...)format(self, pos)highlightBlock(self, text)inherits(self, classname)installEventFilter(self, a0)isQuickItemType(self)isSignalConnected(self, signal)isWidgetType(self)isWindowType(self)killTimer(self, id)metaObject(self)moveToThread(self, thread)objectName(self)parent(self)previousBlockState(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
receivers(self, signal)rehighlight(self)rehighlightBlock(self, block)removeEventFilter(self, a0)sender(self)senderSignalIndex(self)setCurrentBlockState(self, newState)setCurrentBlockUserData(self, data)setDocument(self, doc)setFormat(setFormat setFormat -> None)setObjectName(self, name)setParent(self, a0)setProperty(self, name, value)signalsBlocked(self)startTimer(self, interval[, timerType])thread(self)timerEvent(self, a0)tr(sourceText[, disambiguation, n])validate_match(fmt_name, matched_text, ...)Determine whether a match is invalid based on formatting and block context.
destroyed
objectNameChanged
open_highlight_dialog
- validate_match(fmt_name: str, matched_text: str, block_data: RstBlockData)[source]#
Determine whether a match is invalid based on formatting and block context.
- Parameters:
fmt_name (str) – Name of formatting rule that will be checked for syntax accuracy
matched_text (str) – The matched text fitting the regex pattern on the current line
block_data (RstBlockData) – The current block data
- Returns:
invalid (bool) – Flag indicating valid (False) or invalid (True) syntax
hover_text (str) – Text to display if syntax check is invalid
- common.CodingWidgets.load_highlight_rules(filepath)[source]#
Load highlighting rules.
- Parameters:
filepath (path) – _description_
- Returns:
Highlight rules
- Return type:
Example
from pathlib import Path config_path = Path.home() / ".myapp" / "highlight_rules.json" config_path.parent.mkdir(parents=True, exist_ok=True) save_highlight_rules(AYU_RST_HIGHLIGHT_RULES, config_path)
common.ColorManager module#
Color Manager Handles conversions between different color systems.
Created on Sat Aug 16 2025
@author: Derrick Hasterok
- class common.ColorManager.ColorConverter[source]#
Bases:
objectUnified color conversion system with explicit format specification.
- SUPPORTED_FORMATS = {'cmyk', 'hex', 'hsl', 'hsv', 'qcolor', 'rgb'}#
- common.ColorManager.convert_color(color: Any, input_format: str, output_format: str, norm_in: bool = True, norm_out: bool = True, include_alpha: bool = None, uppercase: bool = True) Any[source]#
Convert color between different formats with explicit format specification.
- Parameters:
color (Any) – Input color in the specified input format
input_format (str) – Input format: ‘rgb’, ‘hsv’, ‘hsl’, ‘cmyk’, ‘hex’, ‘qcolor’
output_format (str) – Output format: ‘rgb’, ‘hsv’, ‘hsl’, ‘cmyk’, ‘hex’, ‘qcolor’
norm_in (bool, default True) – Whether input values are normalized (0-1) or not (0-255 for RGB, 0-360/0-100 for HSV/HSL, etc.)
norm_out (bool, default True) – Whether to return normalized (0-1) or denormalized values
include_alpha (bool, optional) – Whether to include alpha channel. If None, auto-detect based on input
uppercase (bool, default True) – For hex output, whether to use uppercase letters
- Returns:
Converted color in the specified output format, or None if conversion fails
- Return type:
Any
Examples
>>> convert_color([255, 0, 0], 'rgb', 'hex', norm_in=False) '#FF0000'
>>> convert_color('#FF0000', 'hex', 'hsv', norm_out=False) (0.0, 100.0, 100.0)
>>> convert_color(np.array([1.0, 0.0, 0.0]), 'rgb', 'hsl') (0.0, 1.0, 0.5)
>>> convert_color([360, 100, 50], 'hsv', 'rgb', norm_in=False, norm_out=False) (128, 0, 128)
common.ColormapEditor module#
Custom Colormap Editor
Created on Sat Aug 16 2025
@author: Derrick Hasterok
- class common.ColormapEditor.AddColorPoint(model, position, color, index=None)[source]#
Bases:
QUndoCommandUndo/redo command to add a color point to a colormap.
- Parameters:
model (ColorMapModel) – The colormap model to which the point will be added.
position (float) – Normalized position in the range [0, 1].
color (QColor) – The color of the new point.
index (int, optional) – Index at which to insert the point (for discrete colormaps). If None, the point is inserted in order by position.
Notes
On redo, a new ColorPoint is added at the specified position. On undo, the inserted point is removed.
Methods
- class common.ColormapEditor.ChangeColor(model, index, new_color)[source]#
Bases:
QUndoCommandUndo/redo command to change the color of an existing point.
- Parameters:
model (ColorMapModel) – The colormap model to modify.
index (int) – Index of the point whose color will be changed.
new_color (QColor) – The new color for the point.
Notes
On redo, applies the new color. On undo, restores the old color.
Methods
- class common.ColormapEditor.ColorMapModel(parent=None)[source]#
Bases:
QObjectShared model that manages color points and an undo/redo stack.
This model is used by both discrete and continuous colormap editors. It supports adding, removing, moving, and modifying color points, while maintaining an undo/redo history. It can also export the current set of points as a matplotlib colormap.
- Signals:
modelChanged (pyqtSigna(None)) – Emits a signal whenever the model is modified.
- color_points#
Current list of color points in the colormap.
- Type:
list of ColorPoint
- undo_stack#
Undo/redo stack for all operations on the model.
- Type:
QUndoStack
- delete_point(index)#
Remove a color point at the given index.
Methods
add_point(position, color[, index])Add a color point.
blockSignals(self, b)change_color(index, new_color)Change the color of an existing point.
childEvent(self, a0)children(self)connectNotify(self, signal)customEvent(self, a0)deleteLater(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)event(self, a0)eventFilter(self, a0, a1)findChild(-> QObjectT)findChildren(...)Get the list of colors.
inherits(self, classname)installEventFilter(self, a0)isQuickItemType(self)isSignalConnected(self, signal)isWidgetType(self)isWindowType(self)Check if the colormap is circular.
Check if the colormap is ternary.
killTimer(self, id)metaObject(self)moveToThread(self, thread)move_point(source_index, target_index)Move a color point to a new index.
objectName(self)on_clean_changed(clean)Handle undo stack clean state changes.
on_index_changed(index)Handle undo/redo index changes.
parent(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
receivers(self, signal)removeEventFilter(self, a0)remove_point(index)Remove a color point.
Reverse the order of all color points.
sender(self)senderSignalIndex(self)setObjectName(self, name)setParent(self, a0)setProperty(self, name, value)set_points(points)Set the full list of color points.
signalsBlocked(self)Space all color points evenly between 0 and 1.
startTimer(self, interval[, timerType])thread(self)timerEvent(self, a0)Convert the model to a matplotlib colormap.
tr(sourceText[, disambiguation, n])destroyed
modelChanged
objectNameChanged
- change_color(index: int, new_color: QColor)[source]#
Change the color of an existing point.
- Parameters:
index (int) – Index of the color point to modify.
new_color (QColor) – The new color.
- get_colors() List[QColor][source]#
Get the list of colors.
- Returns:
Current colors in the colormap.
- Return type:
list of QColor
- is_circular_colormap()[source]#
Check if the colormap is circular.
- Returns:
True if the first and last colors are approximately equal, False otherwise.
- Return type:
- is_ternary_colormap()[source]#
Check if the colormap is ternary.
- Returns:
True if the colormap has 3 or 4 points, False otherwise.
- Return type:
- modelChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- on_clean_changed(clean: bool)[source]#
Handle undo stack clean state changes.
- Parameters:
clean (bool) – True if the undo stack is clean (saved), False otherwise.
- on_index_changed(index: int)[source]#
Handle undo/redo index changes.
- Parameters:
index (int) – Current index of the undo stack.
- remove_point(index: int)[source]#
Remove a color point.
- Parameters:
index (int) – Index of the color point to remove.
- set_points(points: list[ColorPoint])[source]#
Set the full list of color points.
- Parameters:
points (list of ColorPoint) – New list of color points to replace the current ones.
- class common.ColormapEditor.ColorPoint(position: float, color: QColor)[source]#
Bases:
objectA control point in a colormap.
Represents a single color at a given position in a discrete or continuous colormap.
- Parameters:
position (float) – Normalized location of the point in the range [0.0, 1.0].
color (QColor) – The color at this point.
Examples
>>> cp = ColorPoint(0.5, QColor(255, 0, 0)) >>> cp.to_rgb_tuple() (1.0, 0.0, 0.0)
Methods
Convert the color to an RGB tuple in [0, 1] range.
- color: QColor#
- class common.ColormapEditor.ColormapEditorDialog(existing_colormaps: Dict[str, any] = None, title='Colormap Editor', parent=None)[source]#
Bases:
QDialogMain colormap editor dialog.
Provides an interactive interface for creating, editing, previewing, and saving colormaps. Supports discrete and continuous colormaps, color picking, colorblindness simulation, and CSV import/export.
- Parameters:
- model#
Colormap data model that holds color points and manages undo/redo.
- Type:
- colormap_widget#
Widget for selecting and switching colormaps.
- Type:
- discrete_widget#
Widget for editing discrete colormaps.
- Type:
- continuous_widget#
Widget for editing continuous colormaps.
- Type:
- colorbar_widget#
Widget for previewing colormaps in linear form.
- Type:
- preview_widget#
Widget for image-based preview of colormaps.
- Type:
- picker#
Widget for picking colors from an image.
- Type:
- hex_display#
Displays the current color as a hex string.
- Type:
QLineEdit
- undo_action#
Undo action connected to the model’s undo stack.
- Type:
QAction
- redo_action#
Redo action connected to the model’s undo stack.
- Type:
QAction
- update_axes_style_action()[source]#
Enable/disable axes style action depending on the colormap type.
- on_colormap_changed(source, colormap_name)[source]#
Handle loading a new colormap from Matplotlib, Crameri, or custom.
- on_color_picked(new_color)[source]#
Apply color picked from image to selected points or add new point.
Methods
accept(self)acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)Add a new color point or control point.
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Handle closing the dialog.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])Create a new empty colormap with default black and white points.
Add a new entry in the colormap combobox for a new "untitled" colormap.
cursor(self)customEvent(self, a0)deleteLater(self)Delete the currently selected color/control point.
depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)done(self, a0)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)exec(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)Return the current colormap model.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isSizeGripEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)load_csv()Load custom colormaps from a CSV file.
locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)Cycle through allowed axes styles.
on_color_picked(new_color)Apply color picked from the image color picker.
on_colormap_changed([source, colormap_name])Handle a colormap selection change.
on_discrete_selection_changed(selected_index)Handle selection changes in discrete colormap mode.
on_discrete_toggled(is_discrete)Toggle between discrete and continuous colormap editing.
Apply color from hex string to currently selected color points.
on_preview_mode_changed(mode)Update preview mode for colorblind simulation.
on_selection_changed(selected_index)Handle selection changes in continuous colormap mode.
open(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)palette_from_image(colors)Create a colormap from a list of colors sampled from an image.
parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)reject(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)result(self)saveGeometry(self)Save the current colormap to a CSV file.
screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModal(self, modal)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setResult(self, r)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeGripEnabled(self, a0)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_axes_style(style)Set the axes style for the preview widget.
Update the border color of the hex display based on the current text.
setup_ui()Set up the user interface of the dialog.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)Show or hide the image color picker panel.
Show or hide the preview panel.
toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Enable or disable axes style actions depending on allowed colormap types.
Update the enabled/disabled state of add/delete buttons.
update_hex_display(qcolor)Update the hex display box with the currently selected color.
Refresh both colorbar and image previews.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DialogCode
PaintDeviceMetric
RenderFlag
accepted
customContextMenuRequested
destroyed
finished
objectNameChanged
rejected
windowIconChanged
windowIconTextChanged
windowTitleChanged
- add_control_point()[source]#
Add a new color point or control point.
Adds a new color in discrete mode or a control point in continuous mode.
- closeEvent(event)[source]#
Handle closing the dialog.
Rejects the dialog to discard unsaved changes.
- Parameters:
event (QCloseEvent) – The close event.
- create_new_colormap()[source]#
Create a new empty colormap with default black and white points.
Updates the model, combobox entries, and refreshes previews.
- create_new_colormap_entry()[source]#
Add a new entry in the colormap combobox for a new “untitled” colormap.
- delete_control_point()[source]#
Delete the currently selected color/control point.
Deletes the selected color in discrete mode or selected control point in continuous mode.
- get_colormodel()[source]#
Return the current colormap model.
- Returns:
The current colormap model containing color points and undo stack.
- Return type:
- load_csv()[source]#
Load custom colormaps from a CSV file.
Reads hex color data from a CSV file, updates existing colormaps, and refreshes the colormap selection combobox.
- Raises:
QMessageBox.warning – If the file cannot be loaded or no valid colormaps are found.
- on_axes_style_changed()[source]#
Cycle through allowed axes styles.
Changes the axes style of the preview widget among linear, circular, or ternary.
- on_color_picked(new_color)[source]#
Apply color picked from the image color picker.
- Parameters:
new_color (str) – Color in hex format (e.g., “#RRGGBB”).
- on_colormap_changed(source: str = 'Matplotlib', colormap_name: str = 'viridis')[source]#
Handle a colormap selection change.
- on_discrete_selection_changed(selected_index: int)[source]#
Handle selection changes in discrete colormap mode.
- Parameters:
selected_index (int) – Index of the currently selected color.
- on_discrete_toggled(is_discrete: bool)[source]#
Toggle between discrete and continuous colormap editing.
- Parameters:
is_discrete (bool) – True if switching to discrete mode, False for continuous.
- on_hex_changed()[source]#
Apply color from hex string to currently selected color points.
If valid hex string is entered in hex_display, updates the selected points in discrete or continuous mode.
- on_preview_mode_changed(mode: str)[source]#
Update preview mode for colorblind simulation.
- Parameters:
mode (str) – Preview mode: ‘normal’, ‘grayscale’, ‘deuteranopia’, ‘protanopia’, ‘tritanopia’.
- on_selection_changed(selected_index: int)[source]#
Handle selection changes in continuous colormap mode.
- Parameters:
selected_index (int) – Index of the currently selected control point.
- palette_from_image(colors)[source]#
Create a colormap from a list of colors sampled from an image.
- Parameters:
colors (list) – List of color strings or QColor objects sampled from an image.
- save_colormap()[source]#
Save the current colormap to a CSV file.
Prompts the user for a filename and colormap name, writes hex colors to the file, and updates the undo stack.
- Raises:
QMessageBox.warning – If there is no colormap data or the file cannot be written.
- set_axes_style(style)[source]#
Set the axes style for the preview widget.
- Parameters:
style (str) – Axes style: “linear”, “circular”, or “ternary”.
- set_hex_display_color()[source]#
Update the border color of the hex display based on the current text.
The QLineEdit border color is updated to match the hex color entered.
- setup_ui()[source]#
Set up the user interface of the dialog.
Initializes layouts, toolbars, menu bars, color widgets, preview panels, and connects signals to slots.
- toggle_picker()[source]#
Show or hide the image color picker panel.
Adds/removes the picker widget in the layout and updates the preview.
- toggle_preview()[source]#
Show or hide the preview panel.
Adds/removes the preview widget in the layout and updates its contents.
- update_axes_style_action()[source]#
Enable or disable axes style actions depending on allowed colormap types.
Updates the icon, allowed axes styles, and preview widget configuration.
- update_button_states()[source]#
Update the enabled/disabled state of add/delete buttons.
Buttons are enabled/disabled based on selection and mode constraints.
- class common.ColormapEditor.ColormapPreviewWidget(plot_type='linear', parent=None)[source]#
Bases:
FigureCanvasQTAggWidget for previewing colormaps with optional colorblindness simulation.
This widget displays a colormap in various formats (linear colorbar, circular wheel, ternary diagram, or image). It supports previewing under different simulated vision conditions such as grayscale or common types of colorblindness.
- Parameters:
plot_type ({"linear", "circular", "ternary", "image"}, default="linear") – The type of visualization to use for previewing the colormap.
parent (QWidget, optional) – Parent widget for Qt ownership.
- simulate_colorblind_view(cmap)[source]#
Simulates the selected colorblindness mode on a colormap or list of colors.
- Attributes:
- button_pick_id
- callbacks
device_pixel_ratioThe ratio of physical to logical pixels used for the canvas on screen.
- fixed_dpi
- scroll_pick_id
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blit([bbox])Blit the canvas in bbox (default entire canvas).
blockSignals(self, b)buffer_rgba()Get the image as a memoryview to the renderer's buffer.
changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)draw()Render the figure, and queue a request for a Qt draw.
draw_idle()Queue redraw of the Agg buffer and request Qt paintEvent.
dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)flush_events()Flush the GUI events for the figure.
focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)get_default_filename()Return a string, which includes extension, suitable for use as a default filename.
get_default_filetype()Return the default savefig file format as specified in :rc:`savefig.format`.
get_supported_filetypes()Return dict of savefig file formats supported by this backend.
get_supported_filetypes_grouped()Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].
get_width_height(*[, physical])Return the figure width and height in integral points or pixels.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])grab_mouse(ax)Set the child ~.axes.Axes which is grabbing the mouse events.
graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inaxes(xy)Return the topmost visible ~.axes.Axes containing the point xy.
inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)is_saving()Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.
keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)manager_classalias of
FigureManagerQTmapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseEventCoords([pos])Calculate mouse coordinates in physical pixels.
mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)mpl_connect(s, func)Bind function func to event s.
mpl_disconnect(cid)Disconnect the callback with id cid.
nativeEvent(self, eventType, message)nativeParentWidget(self)new_manager(figure, num)Create a new figure manager for figure, using this canvas class.
new_timer([interval, callbacks])Create a new backend-specific subclass of .Timer.
nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Copy the image from the Agg canvas to the qt.drawable.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)print_figure(*args, **kwargs)Render the figure to hardcopy.
print_jpeg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_jpg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_png(filename_or_obj, *[, metadata, ...])Write the figure to a PNG file.
print_tif(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_tiff(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_webp(filename_or_obj, *[, metadata, ...])Write the figure to a WebP file.
property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)release_mouse(ax)Release the mouse grab held by the ~.axes.Axes ax.
removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_colormap(model)Set the colormap model to preview.
set_cursor(cursor)Set the current cursor.
set_preview_mode(mode)Set the preview mode for colorblindness simulation.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)simulate_colorblind_view(cmap)Apply a colorblindness simulation to a colormap or color list.
size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])start_event_loop([timeout])Start a blocking event loop.
statusTip(self)stop_event_loop([event])Stop the current blocking event loop.
style(self)styleSheet(self)switch_backends(FigureCanvasClass)[Deprecated] Instantiate an instance of FigureCanvasClass
tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tostring_argb()Get the image as ARGB bytes.
tostring_rgb()[Deprecated] Get the image as RGB bytes.
tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Update the preview display.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
copy_from_bbox
customContextMenuRequested
destroyed
drawRectangle
get_renderer
minumumSizeHint
objectNameChanged
print_raw
print_rgba
print_to_buffer
restore_region
windowIconChanged
windowIconTextChanged
windowTitleChanged
- set_colormap(model)[source]#
Set the colormap model to preview.
- Parameters:
model (object) – Colormap model instance with a
to_mpl_colormap()method and acolor_pointsattribute. The model defines the colors and interpolation strategy for generating a colormap.
- set_preview_mode(mode: str)[source]#
Set the preview mode for colorblindness simulation.
- Parameters:
mode ({"normal", "grayscale", "protanopia", "deuteranopia", "tritanopia", ...}) – Mode for simulating different types of vision.
"normal"shows the colormap without simulation.
- simulate_colorblind_view(cmap)[source]#
Apply a colorblindness simulation to a colormap or color list.
- Parameters:
cmap (Colormap or list of QColor/tuple or QColor) – The colormap or list of colors to transform. Can be a Matplotlib colormap, a list of QColor objects, or RGB tuples.
- Returns:
transformed – Transformed version of the input with simulated vision applied. Type matches the input (colormap, list of colors, or single color).
- Return type:
Notes
Simulation matrices are applied as linear RGB transformations.
Supported preview modes are defined in
cb_matrices.
- update_preview()[source]#
Update the preview display.
Rebuilds the Matplotlib figure and redraws the colormap visualization based on the current model, plot type, and preview mode.
Notes
For
plot_type="linear", shows a horizontal colorbar.For
plot_type="circular", shows a circular polar plot.For
plot_type="ternary", shows a ternary diagram with color blending.For
plot_type="image", shows a test image with the colormap applied.
- class common.ColormapEditor.ColormapSelector(custom_maps=None, parent=None)[source]#
Bases:
QWidgetA widget for selecting colormaps from multiple sources.
Provides a dropdown to choose between colormap sources (Matplotlib, Crameri, and custom maps), a search box to filter names, and a combobox to select the colormap itself. Emits a signal when the selected colormap changes.
- Signals:
colormapChanged (pyqtSignal(str, str)) – Emitted when the user selects a colormap. The signal carries two strings: - The colormap source name (e.g., “Matplotlib”, “Crameri”, “Custom”). - The selected colormap name.
- Parameters:
- maps#
Dictionary of colormap sources and their available colormap names.
- Type:
dict of {str: list of str}
- source_combobox#
Dropdown to select the colormap source.
- Type:
QComboBox
- search_box#
Text box to filter colormap names.
- Type:
QLineEdit
- cmap_combobox#
Dropdown to select the colormap from the current source.
- Type:
QComboBox
- update_cmap_combo()[source]#
Update the available colormaps based on the current source and search filter.
- get_selected_cmap()[source]#
Emit the colormapChanged signal with the currently selected source and colormap name.
Examples
>>> selector = ColormapSelector(custom_maps=["my_cmap"]) >>> selector.colormapChanged.connect(lambda src, cmap: print(src, cmap))
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)Return the currently selected colormap name.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Update colormap combobox based on current source and search.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
colormapChanged
customContextMenuRequested
destroyed
objectNameChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- colormapChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class common.ColormapEditor.ContinuousColorWidget(parent=None)[source]#
Bases:
QWidgetWidget for editing continuous colormaps with draggable triangular control points.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)Add a new control point at the largest gap between existing points.
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)change_point_color(index)Change the color of a control point using a color selection dialog.
childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)Delete the currently selected control point, if allowed.
depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)draw_triangular_handle(painter, x, color, ...)Draw an equilateral triangular handle at a given x position.
dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)get_color_at_position(position)Get the interpolated color at a given normalized position along the colormap.
get_colormap_x(position)Convert a normalized colormap position (0-1) to widget x coordinate.
Get the bounding rectangle of a triangular handle.
Convert a widget x coordinate to a normalized colormap position.
Get the index of the currently selected point.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(event)Handle double-click events to add a new control point or change a point's color.
mouseGrabber()mouseMoveEvent(event)Handle mouse move events to drag a control point or update cursor shape.
mousePressEvent(event)Handle mouse press events to select or start dragging a control point.
mouseReleaseEvent(event)Handle mouse release events to finalize dragging a control point.
move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Paint the widget, including the colormap gradient and control points.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)Evenly space all control points along the colormap.
stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
selectionChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
Widget for editing continuous colormaps with draggable triangular control points.
This widget allows users to interactively edit a continuous colormap by dragging triangular handles, adding or removing points, and changing their colors. The widget emits signals when the selection changes.
- Signals:
selectionChanged (pyqtSignal(int)) – Signal emitted when the selected point changes. Sends the index of the selected point, or -1 if no point is selected.
- Parameters:
parent (QWidget, optional) – Parent widget which should have a
modelattribute providing the colormap data and signals.
- get_selected_point()[source]#
Returns the index of the currently selected control point (-1 if none).
- get_color_at_position(position)[source]#
Returns the interpolated color at a given normalized position (0-1).
- change_point_color(index)[source]#
Opens a color dialog to change the color of a specified control point.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)Add a new control point at the largest gap between existing points.
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)change_point_color(index)Change the color of a control point using a color selection dialog.
childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)Delete the currently selected control point, if allowed.
depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)draw_triangular_handle(painter, x, color, ...)Draw an equilateral triangular handle at a given x position.
dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)get_color_at_position(position)Get the interpolated color at a given normalized position along the colormap.
get_colormap_x(position)Convert a normalized colormap position (0-1) to widget x coordinate.
Get the bounding rectangle of a triangular handle.
Convert a widget x coordinate to a normalized colormap position.
Get the index of the currently selected point.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(event)Handle double-click events to add a new control point or change a point's color.
mouseGrabber()mouseMoveEvent(event)Handle mouse move events to drag a control point or update cursor shape.
mousePressEvent(event)Handle mouse press events to select or start dragging a control point.
mouseReleaseEvent(event)Handle mouse release events to finalize dragging a control point.
move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Paint the widget, including the colormap gradient and control points.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)Evenly space all control points along the colormap.
stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
selectionChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- add_control_point()[source]#
Add a new control point at the largest gap between existing points.
- Returns:
True if a new point was added; False if maximum number of points reached.
- Return type:
- change_point_color(index: int)[source]#
Change the color of a control point using a color selection dialog.
- Parameters:
index (int) – Index of the control point to change.
- delete_selected_point()[source]#
Delete the currently selected control point, if allowed.
- Returns:
True if a point was deleted; False otherwise.
- Return type:
- draw_triangular_handle(painter: QPainter, x: float, color: QColor, is_selected: bool)[source]#
Draw an equilateral triangular handle at a given x position.
- get_color_at_position(position: float) QColor[source]#
Get the interpolated color at a given normalized position along the colormap.
- Parameters:
position (float) – Normalized position (0-1) along the colormap.
- Returns:
Interpolated color at the given position.
- Return type:
QColor
- get_colormap_x(position: float) float[source]#
Convert a normalized colormap position (0-1) to widget x coordinate.
- get_handle_bounds(x: float) QRectF[source]#
Get the bounding rectangle of a triangular handle.
- Parameters:
x (float) – Horizontal position of the handle in widget coordinates.
- Returns:
Bounding rectangle of the handle.
- Return type:
QRectF
- get_position_from_x(x: float) float[source]#
Convert a widget x coordinate to a normalized colormap position.
- get_selected_point() int[source]#
Get the index of the currently selected point.
- Returns:
Index of selected point, or -1 if no point is selected.
- Return type:
- mouseDoubleClickEvent(event: QMouseEvent)[source]#
Handle double-click events to add a new control point or change a point’s color.
- Parameters:
event (QMouseEvent) – Mouse double-click event information.
- mouseMoveEvent(event: QMouseEvent)[source]#
Handle mouse move events to drag a control point or update cursor shape.
- Parameters:
event (QMouseEvent) – Mouse move event information.
- mousePressEvent(event: QMouseEvent)[source]#
Handle mouse press events to select or start dragging a control point.
- Parameters:
event (QMouseEvent) – Mouse press event information.
- mouseReleaseEvent(event: QMouseEvent)[source]#
Handle mouse release events to finalize dragging a control point.
- Parameters:
event (QMouseEvent) – Mouse release event information.
- paintEvent(event)[source]#
Paint the widget, including the colormap gradient and control points.
- Parameters:
event (QPaintEvent) – Paint event triggering this redraw.
Notes
Draws a gradient for the current colormap.
Draws triangular handles for control points, highlighting the selected one.
- selectionChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class common.ColormapEditor.DiscreteColorWidget(parent=None)[source]#
Bases:
QWidgetWidget for editing discrete colormaps with draggable buttons.
This widget provides an interface to edit a discrete colormap defined in a model. Users can add, remove, reorder, and recolor discrete color points. Each color is represented by a draggable button (DraggableColorButton).
- Parameters:
parent (QWidget, optional) – Parent widget. Must provide a model attribute with color_points and signals for synchronization.
- Signals:
selectionChanged (pyqtSignal(int)) – Emitted when the selection of color buttons changes. The integer corresponds to the index of the color point, or -1 if no selection exists.
- model#
The model that manages colormap data. Expected to provide color_points, modelChanged, and methods such as add_point, remove_point, and change_color.
- Type:
- buttons#
The list of color button widgets currently displayed.
- Type:
- layout#
Layout used to arrange color buttons horizontally.
- Type:
QHBoxLayout
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)Add a new color point to the colormap.
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)change_color(index)Open a color dialog to change a color at a given index.
childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)Delete the currently selected color point(s).
depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)Get the number of selected colors.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)handle_color_click(index)Handle color button click events.
handle_color_move(source_index, target_index)Handle drag-and-drop reordering of color points.
hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)setup_ui()Initialize the layout and UI elements.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Refresh the color buttons to match the model.
Update the visual selection state of all buttons.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
selectionChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- add_color()[source]#
Add a new color point to the colormap.
- Returns:
True if a color was successfully added, False otherwise.
- Return type:
Notes
If no points exist, adds white at position 0.0.
If no selection exists, duplicates the last color at position 1.0.
If a single selection exists, inserts a color after it.
If multiple adjacent selections exist, inserts an interpolated color between them.
- change_color(index: int)[source]#
Open a color dialog to change a color at a given index.
- Parameters:
index (int) – Index of the color point to modify.
Notes
Calls the model’s change_color method if a valid color is chosen from the dialog.
- delete_selected()[source]#
Delete the currently selected color point(s).
Notes
Deletes points in descending index order to avoid shifting.
Updates selected_indices after deletion.
Emits selectionChanged with -1 if no points remain.
Otherwise, selects the closest remaining point.
- get_selected_count() int[source]#
Get the number of selected colors.
- Returns:
The number of currently selected color buttons.
- Return type:
- handle_color_click(index: int)[source]#
Handle color button click events.
- Parameters:
index (int) – The index of the clicked color button.
Notes
Toggles the selection state of the button and emits the selectionChanged signal.
- handle_color_move(source_index: int, target_index: int)[source]#
Handle drag-and-drop reordering of color points.
- Parameters:
Notes
Moves the corresponding ColorPoint in the model.
Reassigns positions evenly across all points.
Updates selection indices accordingly.
Rebuilds buttons and emits modelChanged.
- selectionChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- setup_ui()[source]#
Initialize the layout and UI elements.
Notes
Creates a horizontal layout with spacing and initializes the list of buttons based on the model.
- class common.ColormapEditor.DraggableColorButton(color: QColor, index: int, parent=None)[source]#
Bases:
QPushButtonA draggable color button for discrete colormap editing.
This widget represents a color entry in a discrete colormap. It supports selection, drag-and-drop reordering, and double-click color changes (delegated to the parent widget).
- Parameters:
color (QColor) – The initial color of the button.
index (int) – Index of the button within the parent colormap editor.
parent (QWidget, optional) – Parent widget. If provided, must implement change_color and/or handle_color_move for full functionality.
- color#
The current color of the button.
- Type:
QColor
- drag_start_position#
Position of the mouse press event used to start drag detection.
- Type:
QPoint or None
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)animateClick(self)autoDefault(self)autoExclusive(self)autoFillBackground(self)autoRepeat(self)autoRepeatDelay(self)autoRepeatInterval(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, e)checkStateSet(self)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)click(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(event)Handle drag enter events.
dragLeaveEvent(self, a0)dragMoveEvent(event)Handle drag move events.
dropEvent(event)Handle drop events.
dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, e)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)group(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)hitButton(self, pos)icon(self)iconSize(self)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isCheckable(self)isChecked(self)isDefault(self)isDown(self)isEnabled(self)isEnabledTo(self, a0)isFlat(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, e)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)menu(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(event)Handle double-click events.
mouseGrabber()mouseMoveEvent(event)Handle mouse move events to initiate dragging.
mousePressEvent(event)Handle mouse press events.
mouseReleaseEvent(event)Handle mouse release events.
move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextCheckState(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoDefault(self, a0)setAutoExclusive(self, a0)setAutoFillBackground(self, enabled)setAutoRepeat(self, a0)setAutoRepeatDelay(self, a0)setAutoRepeatInterval(self, a0)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCheckable(self, a0)setChecked(self, a0)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDefault(self, a0)setDisabled(self, a0)setDown(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFlat(self, a0)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setIcon(self, icon)setIconSize(self, size)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMenu(self, menu)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcut(self, key)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setText(self, text)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_color(color)Update the button color.
set_selected(selected)Set the selection state of the button.
sharedPainter(self)shortcut(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMenu(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)text(self)thread(self)timerEvent(self, e)toggle(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Update the button's visual style.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
clicked
customContextMenuRequested
destroyed
objectNameChanged
pressed
released
toggled
windowIconChanged
windowIconTextChanged
windowTitleChanged
- dragEnterEvent(event)[source]#
Handle drag enter events.
- Parameters:
event (QDragEnterEvent) – The drag enter event.
Notes
Accepts the event if it contains text data (expected to be the source index of a dragged color).
- dragMoveEvent(event)[source]#
Handle drag move events.
- Parameters:
event (QDragMoveEvent) – The drag move event.
Notes
Accepts the event if it contains text data.
- dropEvent(event)[source]#
Handle drop events.
- Parameters:
event (QDropEvent) – The drop event containing the source button index.
Notes
If the drop is valid, notifies the parent widget via handle_color_move(source_index, target_index).
- mouseDoubleClickEvent(event)[source]#
Handle double-click events.
- Parameters:
event (QMouseEvent) – The mouse double-click event.
Notes
If not dragging, calls the parent widget’s change_color(index) method if it exists.
- mouseMoveEvent(event)[source]#
Handle mouse move events to initiate dragging.
- Parameters:
event (QMouseEvent) – The mouse move event.
Notes
If the left button is held and the mouse has moved beyond a small threshold, a drag operation is started. The button index is passed via QMimeData.
- mousePressEvent(event)[source]#
Handle mouse press events.
- Parameters:
event (QMouseEvent) – The mouse press event.
Notes
If the left button is pressed, the drag start position is recorded.
- mouseReleaseEvent(event)[source]#
Handle mouse release events.
- Parameters:
event (QMouseEvent) – The mouse release event.
Notes
Resets the dragging flag shortly after release to allow proper double-click detection.
- set_color(color: QColor)[source]#
Update the button color.
- Parameters:
color (QColor) – The new color to assign to the button.
- class common.ColormapEditor.MoveColorPoint(model, source_index, target_index)[source]#
Bases:
QUndoCommandUndo/redo command to move a color point between indices.
- Parameters:
model (ColorMapModel) – The colormap model to modify.
source_index (int) – The original index of the color point.
target_index (int) – The new index to which the point will be moved.
Notes
On redo, moves the point to the target index. On undo, moves it back to the source index.
Methods
- class common.ColormapEditor.MoveContinuousPointCommand(model, index, old_pos, new_pos)[source]#
Bases:
QUndoCommandUndo/redo command to move a color point within a continuous colormap.
- Parameters:
model (ColorMapModel) – The colormap model to modify.
index (int) – Index of the point being moved.
old_pos (float) – The original normalized position.
new_pos (float) – The new normalized position.
Notes
On redo, sets the point’s position to new_pos. On undo, restores the original old_pos.
Methods
- class common.ColormapEditor.RemoveColorPoint(model, index)[source]#
Bases:
QUndoCommandUndo/redo command to remove a color point from a colormap.
- Parameters:
model (ColorMapModel) – The colormap model to modify.
index (int) – Index of the point to remove.
Notes
On redo, removes the point at the given index. On undo, restores the point and its original positions.
Methods
- class common.ColormapEditor.ReverseColorPoints(model)[source]#
Bases:
QUndoCommandUndo/redo command to reverse the order of color points.
- Parameters:
model (ColorMapModel) – The colormap model to modify.
Notes
On redo, reverses the colormap. On undo, applies the reverse operation again to restore the original order.
Methods
- class common.ColormapEditor.SpaceEvenlyPointsCommand(model)[source]#
Bases:
QUndoCommandUndo/redo command to distribute color points evenly across [0, 1].
- Parameters:
model (ColorMapModel) – The colormap model to modify.
Notes
On redo, spaces all points evenly. On undo, restores the original positions.
Methods
- common.ColormapEditor.fix_positions(model)[source]#
Normalize and fix color point positions for a colormap model.
For discrete models, color points are evenly spaced between 0.0 and 1.0. For continuous models, boundary points are set to 0.0 and 1.0, and intermediate points are redistributed proportionally.
- Parameters:
model (object) – The colormap model containing a list of color_points and an optional is_discrete attribute.
- Returns:
model – The updated model with corrected point positions.
- Return type:
Notes
For discrete models with one point, its position is set to 0.5.
For continuous models: * One point → positioned at 0.5. * Two points → fixed at 0.0 and 1.0. * Three or more points → endpoints fixed at 0.0 and 1.0, others
evenly distributed in between.
- common.ColormapEditor.fix_positions_after_removal(model, removed_position=None)[source]#
Adjust positions after removing a color point.
Ensures consistent spacing of color points after one is deleted. For discrete colormaps, points are evenly redistributed. For continuous colormaps, if an endpoint is removed, the remaining points are scaled to preserve the range [0.0, 1.0].
- Parameters:
- Returns:
model – The updated model with adjusted color point positions.
- Return type:
Notes
For discrete models: * Points are always redistributed evenly.
For continuous models: * If an endpoint was removed, positions are linearly rescaled
to restore 0.0 and 1.0 at the new boundaries.
common.ColorPicker module#
Color Picker
Created on Sat Aug 16 2025
@author: Derrick Hasterok
- class common.ColorPicker.ImageColorPicker(parent=None)[source]#
Bases:
QWidgetMain widget that shows an image and a magnifier. Emits signals for picked colors.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(event)Accept drag events containing images or file URLs.
dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(event)Handle drop events.
dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(obj, event)Filter mouse events on the image label.
find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)on_image_mouse_click(widget_pos)Pick color at the mouse position and emit colorPicked signal.
on_image_mouse_move(widget_pos)Update magnifier based on mouse move over the image.
Open an image from a file dialog and display it.
overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)Paste an image from the system clipboard and display it.
physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
Convert the current QPixmap to a PIL Image in RGB format.
raise_(self)receivers(self, signal)rect(self)Generate a palette from the image using region-based K-means clustering.
releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_pixmap(pixmap)Set the displayed pixmap and convert to QImage for processing.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(event)Zoom the displayed image on mouse wheel scroll.
widget_to_image_coords(widget_pos)Convert widget coordinates to image pixel coordinates.
width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
colorPicked
customContextMenuRequested
destroyed
objectNameChanged
paletteCreated
windowIconChanged
windowIconTextChanged
windowTitleChanged
- colorPicked#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- dragEnterEvent(event)[source]#
Accept drag events containing images or file URLs.
- Parameters:
event (QDragEnterEvent) – Drag event.
- dropEvent(event)[source]#
Handle drop events. Accepts images or file URLs.
- Parameters:
event (QDropEvent) – Drop event.
- eventFilter(obj, event)[source]#
Filter mouse events on the image label.
Handles mouse move (update magnifier), click (pick color), and leave (hide magnifier).
- Parameters:
obj (QObject) – Object that received the event.
event (QEvent) – The event object.
- Returns:
True if the event was handled, otherwise False.
- Return type:
- on_image_mouse_click(widget_pos: QPoint)[source]#
Pick color at the mouse position and emit colorPicked signal.
- Parameters:
widget_pos (QPoint) – Mouse click position in widget coordinates.
- on_image_mouse_move(widget_pos: QPoint)[source]#
Update magnifier based on mouse move over the image.
- Parameters:
widget_pos (QPoint) – Mouse position in widget coordinates.
- paletteCreated#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- qpixmap_to_pil() Image[source]#
Convert the current QPixmap to a PIL Image in RGB format.
- Returns:
The converted PIL image.
- Return type:
PIL.Image.Image
- region_based_palette_qpixmap()[source]#
Generate a palette from the image using region-based K-means clustering.
Downsamples the image, clusters colors, sorts by hue, and emits paletteCreated signal.
- set_pixmap(pixmap: QPixmap)[source]#
Set the displayed pixmap and convert to QImage for processing.
Handles device pixel ratio and scales to fit the viewport if necessary.
- Parameters:
pixmap (QPixmap) – Pixmap to display and process.
- wheelEvent(event: QWheelEvent)[source]#
Zoom the displayed image on mouse wheel scroll.
- Parameters:
event (QWheelEvent) – Mouse wheel event.
- class common.ColorPicker.Magnifier(parent=None, grid_size: int = 15, zoom: int = 8, size: int = 180)[source]#
Bases:
QWidgetFloating magnifier widget showing a zoomed region around a point in an image.
The magnifier is DPI-aware and expects (image, image_pos_x, image_pos_y) where image is a QImage in device pixel coordinates.
- _image#
Image being magnified.
- Type:
QImage
- _center_color#
Color of the center pixel.
- Type:
QColor
- Parameters:
- set_image_and_pos(image, img_x, img_y)[source]#
Set the image and center position for magnification.
- paintEvent(event)[source]#
Paint the magnifier preview, showing the zoomed region, grid lines, and center color.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Paint the magnifier preview.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_image_and_pos(image, img_x, img_y)Set the image and center position for magnification.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- paintEvent(event)[source]#
Paint the magnifier preview.
Draws the zoomed region with grid lines, highlights the center pixel, and displays a color swatch with RGB and hex values below the grid.
- Parameters:
event (QPaintEvent) – The paint event from Qt.
common.ColorSelector module#
- class common.ColorSelector.ColorSelectorDialog(initial_color=None, parent=None)[source]#
Bases:
QDialogColor selector as a dialog that can return a color or None
Methods
accept()Called when OK is pressed - save the selected color
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Handle window close button - same as cancel
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)done(self, a0)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(source, event)Event filter: remove units when editing starts
exec(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)Get path for storing color history
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isSizeGripEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)Load color history from file
locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)Handle hue editing finished: validate + update color
on_text_RGB_finished(source)Handle RGB editing finished: validate + update color
on_text_SV_finished(source)Handle saturation or value editing finished: validate + update color
open(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)reject()Called when Cancel is pressed or dialog is closed without OK
releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)restore_color(button)When a history button is clicked, use its color.
result(self)saveGeometry(self)Save current pick_color into history (button backgrounds).
Save color history to file
screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModal(self, modal)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setResult(self, r)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeGripEnabled(self, a0)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DialogCode
PaintDeviceMetric
RenderFlag
accepted
customContextMenuRequested
destroyed
finished
objectNameChanged
on_hover_color
on_pick_color
rejected
setupUI
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.ColorSelector.DualPatch[source]#
Bases:
QWidgetShows two color patches: left = selected, right = under-mouse.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
set_hover
set_selected
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.ColorSelector.HueSlider(parent=None)[source]#
Bases:
QSliderMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, e)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)hasTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)invertedAppearance(self)invertedControls(self)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isSliderDown(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, ev)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximum(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimum(self)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, ev)mousePressEvent(self, ev)mouseReleaseEvent(self, ev)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)orientation(self)overrideWindowFlags(self, type)overrideWindowState(self, state)pageStep(self)paintEngine(self)paintEvent(self, ev)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)repeatAction(self)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setInvertedAppearance(self, a0)setInvertedControls(self, a0)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximum(self, a0)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimum(self, a0)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setOrientation(self, a0)setPageStep(self, a0)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setRange(self, min, max)setRepeatAction(self, action[, ...])setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSingleStep(self, a0)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setSliderDown(self, a0)setSliderPosition(self, a0)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTickInterval(self, ti)setTickPosition(self, position)setToolTip(self, a0)setToolTipDuration(self, msec)setTracking(self, enable)setUpdatesEnabled(self, enable)setValue(self, a0)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)singleStep(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)sliderChange(self, change)sliderPosition(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)tickInterval(self)tickPosition(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])triggerAction(self, action)underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)value(self)visibleRegion(self)whatsThis(self)wheelEvent(self, e)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
SliderAction
SliderChange
TickPosition
actionTriggered
customContextMenuRequested
destroyed
objectNameChanged
rangeChanged
sliderMoved
sliderPressed
sliderReleased
valueChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.ColorSelector.MainWindow[source]#
Bases:
QMainWindowMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addDockWidget(addDockWidget)addToolBar(-> None)addToolBarBreak(self[, area])adjustSize(self)Handle Apply button in standalone mode
autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)centralWidget(self)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, event)contextMenuPolicy(self)corner(self, corner)create(self[, window, initializeWindow, ...])createPopupMenu(self)createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dockOptions(self)dockWidgetArea(self, dockwidget)documentMode(self)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)iconSize(self)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)insertToolBar(self, before, toolbar)insertToolBarBreak(self, before)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAnimated(self)isDockNestingEnabled(self)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSeparator(self, pos)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)menuBar(self)menuWidget(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeDockWidget(self, dockwidget)removeEventFilter(self, a0)removeToolBar(self, toolbar)removeToolBarBreak(self, before)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeDocks(self, docks, sizes, orientation)resizeEvent(self, a0)restoreDockWidget(self, dockwidget)restoreGeometry(self, geometry)restoreState(self, state[, version])saveGeometry(self)saveState(self[, version])screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAnimated(self, enabled)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCentralWidget(self, widget)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCorner(self, corner, area)setCursor(self, a0)setDisabled(self, a0)setDockNestingEnabled(self, enabled)setDockOptions(self, options)setDocumentMode(self, enabled)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setIconSize(self, iconSize)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMenuBar(self, menubar)setMenuWidget(self, menubar)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusBar(self, statusbar)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabPosition(self, areas, tabPosition)setTabShape(self, tabShape)setTabletTracking(self, enable)setToolButtonStyle(self, toolButtonStyle)setToolTip(self, a0)setToolTipDuration(self, msec)setUnifiedTitleAndToolBarOnMac(self, set)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)splitDockWidget(self, after, dockwidget, ...)stackUnder(self, a0)startTimer(self, interval[, timerType])statusBar(self)statusTip(self)style(self)styleSheet(self)tabPosition(self, area)tabShape(self)tabifiedDockWidgets(self, dockwidget)tabifyDockWidget(self, first, second)tabletEvent(self, a0)takeCentralWidget(self)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolBarArea(self, toolbar)toolBarBreak(self, toolbar)toolButtonStyle(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unifiedTitleAndToolBarOnMac(self)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockOption
PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
iconSizeChanged
objectNameChanged
setupUI
tabifiedDockWidgetActivated
toolButtonStyleChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.ColorSelector.TernaryHVWidget[source]#
Bases:
QWidgetTernary with vertices: Black (bottom-left), White (bottom-right), Pure Hue (top). A saturation multiplier slider can globally reduce S after picking from triangle.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mix_color(t)RGB from barycentric weights with vertices B(0,0,0), W(1,1,1), H(pure hue).
mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)Convert hue (0-1) to RGB tuple using HSV with full saturation and value
pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_hue(h)Set hue value (expects 0.0-1.0 range)
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
hoverColor
objectNameChanged
pickColor
set_saturation_scale
windowIconChanged
windowIconTextChanged
windowTitleChanged
- hoverColor#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- pickColor#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- common.ColorSelector.select_color(initial_color=None, parent=None)[source]#
Show color selector dialog and return selected color.
- Parameters:
initial_color – Initial color as hex string (e.g., “#FF0000”) or None for white
parent – Parent widget for the dialog
- Returns:
Selected color as hex string (e.g., “#FF0000”) or None if cancelled
common.CustomMplCanvas module#
- class common.CustomMplCanvas.MplCanvas(fig=None, sub=111, parent=None, width=5, height=4, proj=None, ui=None, map_flag=False)[source]#
Bases:
FigureCanvasQTAgg,ObservableMatplotlib canvas object for interactive plots
- Parameters:
- Attributes:
- button_pick_id
- callbacks
dataReturn the stored pandas DataFrame.
device_pixel_ratioThe ratio of physical to logical pixels used for the canvas on screen.
distancestr : when distance tool is active, the distance of the line
- fixed_dpi
plot_nameReturn the stored pandas DataFrame.
- scroll_pick_id
valuestr : volue at mouse pointer location
xposstr : x position of mouse pointer on canvas
yposstr : y position of mouse pointer on canvas
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)add_observer(event_name, callback)Register a callback function to be called when a property changes.
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blit([bbox])Blit the canvas in bbox (default entire canvas).
blockSignals(self, b)buffer_rgba()Get the image as a memoryview to the renderer's buffer.
calculate_distance(p1, p2)Calculuates distance on a figure
changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)distanceOnClick(event)Updates static endpoints of distance measuring line.
distanceOnMove(event)Updates dynamic second point of distance measuring line.
Resets distance variables and clears plot
dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)draw()Render the figure, and queue a request for a Qt draw.
draw_idle()Queue redraw of the Agg buffer and request Qt paintEvent.
dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)flush_events()Flush the GUI events for the figure.
focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)get_default_filename()Return a string, which includes extension, suitable for use as a default filename.
get_default_filetype()Return the default savefig file format as specified in :rc:`savefig.format`.
get_supported_filetypes()Return dict of savefig file formats supported by this backend.
get_supported_filetypes_grouped()Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].
get_width_height(*[, physical])Return the figure width and height in integral points or pixels.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])grab_mouse(ax)Set the child ~.axes.Axes which is grabbing the mouse events.
graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inaxes(xy)Return the topmost visible ~.axes.Axes containing the point xy.
inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)is_saving()Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.
keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)load_figure(fig)Load existing figure
locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)manager_classalias of
FigureManagerQTmapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseEventCoords([pos])Calculate mouse coordinates in physical pixels.
mouseGrabber()mouseLocation(event)Get mouse location on axes for display
mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)mpl_connect(s, func)Bind function func to event s.
mpl_disconnect(cid)Disconnect the callback with id cid.
nativeEvent(self, eventType, message)nativeParentWidget(self)new_manager(figure, num)Create a new figure manager for figure, using this canvas class.
new_timer([interval, callbacks])Create a new backend-specific subclass of .Timer.
nextInFocusChain(self)normalGeometry(self)notify_observers(event_name, *args, **kwargs)Notify all registered observers of an event or property change.
objectName(self)on_click(event)Handle left/right clicks for distance calculation, polygons and profiles.
on_mouse_move(event)Optional: handle dynamic feedback (e.g., while moving a polygon vertex).
overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Copy the image from the Agg canvas to the qt.drawable.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)plot_line(p1, p2)Plots line from distance calculation
plot_text(p1, p2)Adds distance to plot and updates distance label
pos(self)previousInFocusChain(self)print_figure(*args, **kwargs)Render the figure to hardcopy.
print_jpeg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_jpg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_png(filename_or_obj, *[, metadata, ...])Write the figure to a PNG file.
print_tif(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_tiff(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_webp(filename_or_obj, *[, metadata, ...])Write the figure to a WebP file.
property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)release_mouse(ax)Release the mouse grab held by the ~.axes.Axes ax.
removeAction(self, action)removeEventFilter(self, a0)remove_observer(event_name, callback)Deregister a callback function from an event.
render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)Restores the initial extent
saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)Gets the cursor position on an MplCanvas
setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_cursor(cursor)Set the current cursor.
Initial extent of the plot
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])start_event_loop([timeout])Start a blocking event loop.
statusTip(self)stop_event_loop([event])Stop the current blocking event loop.
style(self)styleSheet(self)switch_backends(FigureCanvasClass)[Deprecated] Instantiate an instance of FigureCanvasClass
tabletEvent(self, a0)testAttribute(self, attribute)textOnClick(event)Adds text to plot at clicked position
thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tostring_argb()Get the image as ARGB bytes.
tostring_rgb()[Deprecated] Get the image as RGB bytes.
tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
copy_from_bbox
customContextMenuRequested
destroyed
disable_distance_mode
disable_tool
drawRectangle
enable_distance_mode
enable_tool
get_renderer
minumumSizeHint
objectNameChanged
print_raw
print_rgba
print_to_buffer
redraw_annotations
restore_region
toggle_tool
windowIconChanged
windowIconTextChanged
windowTitleChanged
- property data#
Return the stored pandas DataFrame.
- distanceOnClick(event)[source]#
Updates static endpoints of distance measuring line.
Updates the endpoint of the distance measuring line and calls methods that update the line and text. Updates
MplCanvas.first_pointif it is the start of the line andMplCanvas.line_savedandMplCanvas.dtext_savedif it is the end of the line.- Parameters:
event (MouseEvent) – Mouse click event.
- distanceOnMove(event)[source]#
Updates dynamic second point of distance measuring line.
Updates the second endpoint of the distance measuring line and calls methods that update the line and text. Updates
MplCanvas.lineandMplCanvas.dtext.- Parameters:
event (MouseEvent) – Mouse click event.
- distance_reset()[source]#
Resets distance variables and clears plot
Sets
MplCanvas.first_pointtoNone,MplCanvas.lineandMplCanvas.dtext. IfMainWindow.toolButtonDistanceis not checked, thenMainWindow.labelInfoDistanceis also reset.
- load_figure(fig)[source]#
Load existing figure
- Parameters:
fig (matplotlib.Figure) – Matplotlib figure.
- mouseLocation(event)[source]#
Get mouse location on axes for display
Displays the location and value of a map in
MainWindow.widgetPlotInfoSV.- Parameters:
event (event data) – Includes the location of mouse pointer.
- on_mouse_move(event)[source]#
Optional: handle dynamic feedback (e.g., while moving a polygon vertex).
- property plot_name#
Return the stored pandas DataFrame.
- plot_text(p1, p2)[source]#
Adds distance to plot and updates distance label
Updates distance in
MainWindow.labelInfoDistanceand adds distance at the end of the measuring line.
- restore_view()[source]#
Restores the initial extent
Restores the initial extent when
homesignal is received.- Seealso:
toggle_tool
- class common.CustomMplCanvas.SimpleMplCanvas(sub=111, parent=None, width=5, height=4, proj=None)[source]#
Bases:
FigureCanvasQTAggMatplotlib canvas object for non-interactive plots
- Parameters:
- Attributes:
- button_pick_id
- callbacks
device_pixel_ratioThe ratio of physical to logical pixels used for the canvas on screen.
- fixed_dpi
- scroll_pick_id
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blit([bbox])Blit the canvas in bbox (default entire canvas).
blockSignals(self, b)buffer_rgba()Get the image as a memoryview to the renderer's buffer.
changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)draw()Render the figure, and queue a request for a Qt draw.
draw_idle()Queue redraw of the Agg buffer and request Qt paintEvent.
dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)flush_events()Flush the GUI events for the figure.
focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)get_default_filename()Return a string, which includes extension, suitable for use as a default filename.
get_default_filetype()Return the default savefig file format as specified in :rc:`savefig.format`.
get_supported_filetypes()Return dict of savefig file formats supported by this backend.
get_supported_filetypes_grouped()Return a dict of savefig file formats supported by this backend, where the keys are a file type name, such as 'Joint Photographic Experts Group', and the values are a list of filename extensions used for that filetype, such as ['jpg', 'jpeg'].
get_width_height(*[, physical])Return the figure width and height in integral points or pixels.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])grab_mouse(ax)Set the child ~.axes.Axes which is grabbing the mouse events.
graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inaxes(xy)Return the topmost visible ~.axes.Axes containing the point xy.
inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)is_saving()Return whether the renderer is in the process of saving to a file, rather than rendering for an on-screen buffer.
keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)manager_classalias of
FigureManagerQTmapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseEventCoords([pos])Calculate mouse coordinates in physical pixels.
mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)mpl_connect(s, func)Bind function func to event s.
mpl_disconnect(cid)Disconnect the callback with id cid.
nativeEvent(self, eventType, message)nativeParentWidget(self)new_manager(figure, num)Create a new figure manager for figure, using this canvas class.
new_timer([interval, callbacks])Create a new backend-specific subclass of .Timer.
nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Copy the image from the Agg canvas to the qt.drawable.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)print_figure(*args, **kwargs)Render the figure to hardcopy.
print_jpeg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_jpg(filename_or_obj, *[, metadata, ...])Write the figure to a JPEG file.
print_png(filename_or_obj, *[, metadata, ...])Write the figure to a PNG file.
print_tif(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_tiff(filename_or_obj, *[, metadata, ...])Write the figure to a TIFF file.
print_webp(filename_or_obj, *[, metadata, ...])Write the figure to a WebP file.
property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)release_mouse(ax)Release the mouse grab held by the ~.axes.Axes ax.
removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_cursor(cursor)Set the current cursor.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])start_event_loop([timeout])Start a blocking event loop.
statusTip(self)stop_event_loop([event])Stop the current blocking event loop.
style(self)styleSheet(self)switch_backends(FigureCanvasClass)[Deprecated] Instantiate an instance of FigureCanvasClass
tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tostring_argb()Get the image as ARGB bytes.
tostring_rgb()[Deprecated] Get the image as RGB bytes.
tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
copy_from_bbox
customContextMenuRequested
destroyed
drawRectangle
get_renderer
minumumSizeHint
objectNameChanged
print_raw
print_rgba
print_to_buffer
restore_region
windowIconChanged
windowIconTextChanged
windowTitleChanged
common.CustomWidgets module#
- class common.CustomWidgets.ColorButton(permanent_text=None, ui=None, parent=None, initial_color=None)[source]#
Bases:
QPushButtonA QPushButton subclass that allows the user to select a background color via a QColorDialog. The widget tracks a history of recently selected colors and emits a signal whenever the color changes.
Features: - Emits colorChanged(QColor) when the button’s color is updated. - Maintains a history of recently used colors for quick access. - Displays the selected color as the button background.
- permanent_text#
Fixed text displayed on the button. If None, the button text shows the selected color’s hex code.
- Type:
str or None
- ui#
Reference to the parent UI component, used as the parent for the color dialog.
- Type:
QWidget or None
- Signals:
colorChanged(QColor) – Emitted when the button’s background color changes.
- Parameters:
permanent_text (str or None) – Fixed text to display on the button. If None, the button text will display the color’s hex code.
ui (QWidget or None) – Parent UI component, used as the parent for the color dialog.
parent (QWidget or None) – Parent widget in the Qt hierarchy.
Example
btn = ColorButton(“Pick Color”) btn.colorChanged.connect(lambda c: print(“New color:”, c.name()))
- Attributes:
colorQColor : Return the current background color of the button.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)animateClick(self)autoDefault(self)autoExclusive(self)autoFillBackground(self)autoRepeat(self)autoRepeatDelay(self)autoRepeatInterval(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, e)checkStateSet(self)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)click(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, e)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)group(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)hitButton(self, pos)icon(self)iconSize(self)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isCheckable(self)isChecked(self)isDefault(self)isDown(self)isEnabled(self)isEnabledTo(self, a0)isFlat(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, e)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)menu(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, e)mouseReleaseEvent(self, e)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextCheckState(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)Open a QColorDialog to allow the user to select a color.
sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoDefault(self, a0)setAutoExclusive(self, a0)setAutoFillBackground(self, enabled)setAutoRepeat(self, a0)setAutoRepeatDelay(self, a0)setAutoRepeatInterval(self, a0)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCheckable(self, a0)setChecked(self, a0)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDefault(self, a0)setDisabled(self, a0)setDown(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFlat(self, a0)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setIcon(self, icon)setIconSize(self, size)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMenu(self, menu)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcut(self, key)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setText(self, text)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)shortcut(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMenu(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)text(self)thread(self)timerEvent(self, e)toggle(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
clicked
colorChanged
customContextMenuRequested
destroyed
objectNameChanged
pressed
released
toggled
windowIconChanged
windowIconTextChanged
windowTitleChanged
- property color#
Return the current background color of the button.
- Type:
QColor
- colorChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class common.CustomWidgets.CustomAction(text: str, light_icon_unchecked: str, light_icon_checked: str | None = None, dark_icon_unchecked: str | None = None, dark_icon_checked: str | None = None, parent=None)[source]#
Bases:
QActionAn action that changes icons when checked or the theme changes from light to dark
- self._light_icon_unchecked#
Icon for light, unchecked state
- Type:
QIcon
- self._light_icon_checked#
Icon for light, checked state
- Type:
QIcon
- self._dark_icon_unchecked#
Icon for dark, unchecked state
- Type:
QIcon
- self._dark_icon_checked#
Icon for dark, checked state
- Type:
QIcon
- Parameters:
text (str) – Text to display by widget
light_icon_unchecked (str) – Unchecked icon filename for light color theme.
light_icon_checked (str | None) – Checked icon filename for light color theme. If None, the icon is not checkable
dark_icon_unchecked (str) – Unchecked icon filename for dark color theme.
dark_icon_checked (str | None) – Checked icon filename for dark color theme. If None, the icon is not checkable
button_size (int) – Size of button in pt.
icon_size (int) – Size of icon on button in pt.
parent (QToolButton) – Tool button to set icons.
Methods
actionGroup(self)activate(self, event)associatedObjects(self)autoRepeat(self)blockSignals(self, b)childEvent(self, a0)children(self)connectNotify(self, signal)customEvent(self, a0)data(self)deleteLater(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)event(self, a0)eventFilter(self, a0, a1)findChild(-> QObjectT)findChildren(...)font(self)hover(self)icon(self)iconText(self)inherits(self, classname)installEventFilter(self, a0)isCheckable(self)isChecked(self)isEnabled(self)isIconVisibleInMenu(self)isQuickItemType(self)isSeparator(self)isShortcutVisibleInContextMenu(self)isSignalConnected(self, signal)isVisible(self)isWidgetType(self)isWindowType(self)killTimer(self, id)menu(self)menuRole(self)metaObject(self)moveToThread(self, thread)objectName(self)parent(self)priority(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
receivers(self, signal)removeEventFilter(self, a0)resetEnabled(self)sender(self)senderSignalIndex(self)setActionGroup(self, group)setAutoRepeat(self, a0)setCheckable(self, a0)setChecked(self, a0)setData(self, var)setDisabled(self, b)setEnabled(self, a0)setFont(self, font)setIcon(self, icon)setIconText(self, text)setIconVisibleInMenu(self, visible)setMenu(self, menu)setMenuRole(self, menuRole)setObjectName(self, name)setParent(self, a0)setPriority(self, priority)setProperty(self, name, value)setSeparator(self, b)setShortcut(self, shortcut)setShortcutContext(self, context)setShortcutVisibleInContextMenu(self, show)setShortcuts(setShortcuts)setStatusTip(self, statusTip)setText(self, text)setToolTip(self, tip)setVisible(self, a0)setWhatsThis(self, what)set_theme(theme)Updates the icon to light/dark theme.
shortcut(self)shortcutContext(self)shortcuts(self)showStatusText(self[, object])signalsBlocked(self)startTimer(self, interval[, timerType])statusTip(self)text(self)thread(self)timerEvent(self, a0)toggle(self)toolTip(self)tr(sourceText[, disambiguation, n])trigger(self)Update the icon based on the button's checked state and theme.
whatsThis(self)ActionEvent
MenuRole
Priority
changed
checkableChanged
destroyed
enabledChanged
hovered
objectNameChanged
toggled
triggered
visibleChanged
- class common.CustomWidgets.CustomActionMenu(text, menu_items, light_icon_unchecked: str, dark_icon_unchecked: str | None = None, parent=None)[source]#
Bases:
CustomActionA custom QMenu that allows dynamic addition and removal of menu lame_action.
- items#
A dictionary mapping action names (as strings) to their corresponding QAction objects.
Add a single menu item with an optional shortcut and tooltip.
Remove a menu item by name if it exists.
Add multiple menu items in one batch operation.
Remove all existing menu actions from the menu and clear the internal items dictionary.
Clear and rebuild the menu using the provided list of items.
Return the QAction associated with the given name, or None if not found.
Return current menu structure as a nested list.
Check if a submenu by a specific name exists.
- Parameters:
Methods
actionGroup(self)activate(self, event)add_menu_item(text, callback_or_submenu)Adds a single menu item to the specified QMenu.
associatedObjects(self)autoRepeat(self)blockSignals(self, b)childEvent(self, a0)children(self)Clear all actions and submenus from the menu.
connectNotify(self, signal)customEvent(self, a0)data(self)deleteLater(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)event(self, a0)eventFilter(self, a0, a1)findChild(-> QObjectT)findChildren(...)font(self)Return current menu structure as a nested list.
has_submenu(name)Check if a submenu by a specific name exists.
hover(self)icon(self)iconText(self)inherits(self, classname)installEventFilter(self, a0)isCheckable(self)isChecked(self)isEnabled(self)isIconVisibleInMenu(self)isQuickItemType(self)isSeparator(self)isShortcutVisibleInContextMenu(self)isSignalConnected(self, signal)isVisible(self)isWidgetType(self)isWindowType(self)killTimer(self, id)menu(self)menuRole(self)metaObject(self)moveToThread(self, thread)objectName(self)parent(self)priority(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
receivers(self, signal)removeEventFilter(self, a0)remove_menu_item(menu_path)Remove a menu item or submenu by its path.
resetEnabled(self)sender(self)senderSignalIndex(self)setActionGroup(self, group)setAutoRepeat(self, a0)setCheckable(self, a0)setChecked(self, a0)setData(self, var)setDisabled(self, b)setEnabled(self, a0)setFont(self, font)setIcon(self, icon)setIconText(self, text)setIconVisibleInMenu(self, visible)setMenu(self, menu)setMenuRole(self, menuRole)setObjectName(self, name)setParent(self, a0)setPriority(self, priority)setProperty(self, name, value)setSeparator(self, b)setShortcut(self, shortcut)setShortcutContext(self, context)setShortcutVisibleInContextMenu(self, show)setShortcuts(setShortcuts)setStatusTip(self, statusTip)setText(self, text)setToolTip(self, tip)setVisible(self, a0)setWhatsThis(self, what)set_theme(theme)Updates the icon to light/dark theme.
shortcut(self)shortcutContext(self)shortcuts(self)showStatusText(self[, object])signalsBlocked(self)startTimer(self, interval[, timerType])statusTip(self)text(self)thread(self)timerEvent(self, a0)toggle(self)toolTip(self)tr(sourceText[, disambiguation, n])trigger(self)update_icon()Update the icon based on the button's checked state and theme.
update_menu(new_items)Replace the entire menu with a new structure.
update_submenu(submenu_name, new_items)Update a submenu with new items.
whatsThis(self)ActionEvent
MenuRole
Priority
changed
checkableChanged
destroyed
enabledChanged
hovered
objectNameChanged
toggled
triggered
visibleChanged
- add_menu_item(text, callback_or_submenu)[source]#
Adds a single menu item to the specified QMenu.
- Parameters:
menu (QMenu) – The menu to which the item will be added.
label (str) – The text label for the menu item.
action (Callable | None) – The function to be called when the menu item is triggered. If None, the menu item will be added as a non-interactive (disabled) item.
- Returns:
The QAction object that was added to the menu.
- Return type:
QAction
Example
self.add_menu_item(file_menu, "Open", self.open_file) self.add_menu_item(help_menu, "About", None) # Adds a non-clickable item
- get_menu_structure()[source]#
Return current menu structure as a nested list.
This method is useful for debugging or serialization.
- Returns:
Current menu structure.
- Return type:
nested list
- remove_menu_item(menu_path)[source]#
Remove a menu item or submenu by its path.
- Parameters:
menu_path (list of str) – A list representing the hierarchical path to the item. For example, [‘Top Level’, ‘Submenu’, ‘Item Text’] will remove the action or submenu named ‘Item Text’ inside ‘Submenu’ which is under ‘Top Level’.
- Returns:
True if the item was found and removed, False otherwise.
- Return type:
Examples
To remove ‘Export’ from the ‘File’ top level,
action.remove_menu_item(['File', 'Export'])
- update_menu(new_items)[source]#
Replace the entire menu with a new structure.
- Parameters:
new_items (list of tuples) –
A list where each tuple represents a menu item.
- Each tuple must be of the form:
(str, Callable | list | None)
:param : :type : see also: _add_menu_items
Update a submenu with new items.
- Parameters:
submenu_name (str) – Name of submenu
new_items (items) –
A list where each tuple represents a menu item.
- Each tuple must be of the form:
(str, Callable | list | None)
:param : :type : see also: _add_menu_items
- class common.CustomWidgets.CustomComboBox(popup_callback=None, *args, **kwargs)[source]#
Bases:
QComboBoxA QComboBox subclass with support for dynamic item updates before showing the popup.
This custom combo box allows you to define a callback function that is executed each time the combo box is about to display its dropdown list. This is useful for updating the list of items dynamically based on application state.
- popup_callback#
A function to be executed immediately before the popup is shown. Typically used to refresh or modify the items in the combo box.
- Type:
callable or None
- showPopup()[source]#
Overrides the base class method to invoke the callback (if set) before showing the popup.
- Parameters:
popup_callback (callable, optional) – A function that updates the combo box items before display. Default is None.
*args – Additional arguments passed to the QComboBox constructor.
**kwargs – Additional arguments passed to the QComboBox constructor.
Examples
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addItem(addItem)addItems(self, texts)adjustSize(self)allItems()Return a list of all item texts in the combobox.
autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, e)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clear(self)clearEditText(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)completer(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, e)contextMenuPolicy(self)count(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])currentData(self[, role])currentIndex(self)currentText(self)cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)duplicatesEnabled(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)findData(self, data[, role, flags])findText(self, text[, flags])focusInEvent(self, e)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, e)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasFrame(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, e)hidePopup(self)iconSize(self)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(-> Any)insertAction(self, before, action)insertActions(self, before, actions)insertItem(insertItem)insertItems(self, index, texts)insertPolicy(self)insertSeparator(self, index)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEditable(self)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)itemData(self, index[, role])itemDelegate(self)itemIcon(self, index)itemText(self, index)keyPressEvent(self, e)keyReleaseEvent(self, e)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)lineEdit(self)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maxCount(self)maxVisibleItems(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumContentsLength(self)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)model(self)modelColumn(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, e)mouseReleaseEvent(self, e)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, e)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)placeholderText(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)removeItem(self, index)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, e)restoreGeometry(self, geometry)rootModelIndex(self)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCompleter(self, c)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCurrentIndex(self, index)setCurrentText(self, text)setCursor(self, a0)setDisabled(self, a0)setDuplicatesEnabled(self, enable)setEditText(self, text)setEditable(self, editable)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrame(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setIconSize(self, size)setInputMethodHints(self, hints)setInsertPolicy(self, policy)setItemData(self, index, value[, role])setItemDelegate(self, delegate)setItemIcon(self, index, icon)setItemText(self, index, text)setLayout(self, a0)setLayoutDirection(self, direction)setLineEdit(self, edit)setLocale(self, locale)setMask(setMask)setMaxCount(self, max)setMaxVisibleItems(self, maxItems)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumContentsLength(self, characters)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModel(self, model)setModelColumn(self, visibleColumn)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setPlaceholderText(self, placeholderText)setProperty(self, name, value)setRootModelIndex(self, index)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeAdjustPolicy(self, policy)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setValidator(self, v)setView(self, itemView)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, e)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)Executes the popup callback (if any) before showing the dropdown list.
signalsBlocked(self)size(self)sizeAdjustPolicy(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)validator(self)view(self)visibleRegion(self)whatsThis(self)wheelEvent(self, e)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)InsertPolicy
PaintDeviceMetric
RenderFlag
SizeAdjustPolicy
activated
currentIndexChanged
currentTextChanged
customContextMenuRequested
destroyed
editTextChanged
highlighted
objectNameChanged
textActivated
textHighlighted
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CustomWidgets.CustomDockWidget(parent=None, *args, **kwargs)[source]#
Bases:
QDockWidgetA custom QDockWidget that hides instead of closing when the user clicks the close button.
This subclass of QDockWidget overrides the standard close behavior so that the widget is simply hidden rather than destroyed. This allows the widget to be shown again later without needing to be re-instantiated.
- Parameters:
parent (QWidget, optional) – The parent widget, typically a QMainWindow. Default is None.
- closeEvent(event: QEvent)[source]#
Hides the dock instead of closing it when the user clicks the close button.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)allowedAreas(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Override the default close event to hide the dock widget instead of closing it.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)features(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAreaAllowed(self, area)isEnabled(self)isEnabledTo(self, a0)isFloating(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, event)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllowedAreas(self, areas)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFeatures(self, features)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFloating(self, floating)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTitleBarWidget(self, widget)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWidget(self, widget)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)titleBarWidget(self)toggleViewAction(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockWidgetFeature
PaintDeviceMetric
RenderFlag
allowedAreasChanged
customContextMenuRequested
destroyed
dockLocationChanged
featuresChanged
objectNameChanged
topLevelChanged
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CustomWidgets.CustomLineEdit(parent=None, value=0.0, precision=4, threshold=10000.0, toward=None, validator=<PyQt6.QtGui.QDoubleValidator object>)[source]#
Bases:
QLineEditCustom line edit widget, when the only input should be of type float
Adds additional functionality to QLineEdit by installing a validator and methods for limiting the precision of the displayed value in the UI. Note that full precision of the value is stored in self.value, only a ‘pretty’ number is displayed.
- Parameters:
parent (_type_, optional) – _description_, by default None
value (float, optional) – _description_, by default 0.0
precision (int, optional) – _description_, by default 4
threshold (_type_, optional) – _description_, by default 1e4
toward (int, optional) – _description_, by default None
validator (QValidator, optional) – Provide a validator to automatically text inputs for appropriate type and ranges, by default QDoubleValidator
- Attributes:
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(-> None)addActions(self, actions)adjustSize(self)alignment(self)autoFillBackground(self)backgroundRole(self)backspace(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clear(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)completer(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)copy(self)create(self[, window, initializeWindow, ...])createStandardContextMenu(self)createWindowContainer(window[, parent, flags])cursor(self)cursorBackward(self, mark[, steps])cursorForward(self, mark[, steps])cursorMoveStyle(self)cursorPosition(self)cursorPositionAt(self, pos)cursorRect(self)cursorWordBackward(self, mark)cursorWordForward(self, mark)customEvent(self, a0)cut(self)del_(self)deleteLater(self)depth(self)deselect(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)displayText(self)dragEnabled(self)dragEnterEvent(self, a0)dragLeaveEvent(self, e)dragMoveEvent(self, e)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)echoMode(self)effectiveWinId(self)end(self, mark)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasAcceptableInput(self)hasFocus(self)hasFrame(self)hasHeightForWidth(self)hasMouseTracking(self)hasSelectedText(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)home(self, mark)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMask(self)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(-> Any)insert(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isClearButtonEnabled(self)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isModified(self)isQuickItemType(self)isReadOnly(self)isRedoAvailable(self)isRightToLeft(self)isSignalConnected(self, signal)isUndoAvailable(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maxLength(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)paste(self)physicalDpiX(self)physicalDpiY(self)placeholderText(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)redo(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)selectAll(self)selectedText(self)selectionEnd(self)selectionLength(self)selectionStart(self)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAlignment(self, flag)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setClearButtonEnabled(self, enable)setCompleter(self, completer)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setCursorMoveStyle(self, style)setCursorPosition(self, a0)setDisabled(self, a0)setDragEnabled(self, b)setEchoMode(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrame(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMask(self, inputMask)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaxLength(self, a0)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModified(self, a0)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setPlaceholderText(self, a0)setProperty(self, name, value)setReadOnly(self, a0)setScreen(self, a0)setSelection(self, a0, a1)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setText(self, a0)setTextMargins(setTextMargins)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setValidator(self, a0)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_bounds([lower, upper])Set optional lower and upper bounds for the value.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)text(self)textMargins(self)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)undo(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)validator(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)ActionPosition
EchoMode
PaintDeviceMetric
RenderFlag
cursorPositionChanged
customContextMenuRequested
destroyed
editingFinished
inputRejected
objectNameChanged
returnPressed
selectionChanged
textChanged
textEdited
windowIconChanged
windowIconTextChanged
windowTitleChanged
- property toward#
Determines rounding direction in formatting.
0 = round toward zero
1 = round away from zero
None = standard rounding
- class common.CustomWidgets.CustomPage(obj_name: str = None, layout_cls=<class 'PyQt6.QtWidgets.QVBoxLayout'>, layout_args=None, scrollable=True, parent=None)[source]#
Bases:
QWidgetA QWidget that contains a QScrollArea with a single content widget and layout. Simplifies putting scrollable pages into QToolBox, QTabWidget, QDockWidget, etc.
- Parameters:
layout_cls (QVBoxLayout | QHBoxLayout | QGridLayout | QFormLayout) – Layout class for the inner content, by default QVBoxLayout
layout_args (dict) – Dictionary of kwargs to pass to the layout constructor
scrollable (bool) – If False, skips the scroll area and uses the content directly, by default True
- Attributes:
- content_layout
- content_widget
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addItem(item)Convenience to add a child item to the inner layout.
addLayout(layout)Convenience to add a child layout to the inner layout.
addWidget(widget)Convenience to add a child widget to the inner layout.
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
setSpacing
windowIconChanged
windowIconTextChanged
windowTitleChanged
- property content_layout: QLayout#
- property content_widget#
- class common.CustomWidgets.CustomSlider(min_value=0, max_value=100, step=1, initial_value=50, precision=1, orientation='horizontal', label_position='low', parent=None)[source]#
Bases:
QWidgetA custom slider widget that combines a horizontal QSlider and a QLabel.
This widget displays the current slider value in a label and emits custom signals for common slider events. It supports setting initial value, range, and step size.
- Parameters:
min_value (float, optional) – Minimum value of the slider range (default is 0).
max_value (float, optional) – Maximum value of the slider range (default is 100).
step (float, optional) – Increment between values (default is 1).
initial_value (float, optional) – Initial slider value (default is 50).
parent (QWidget, optional) – Parent widget (default is None).
- Signals:
valueChanged(int) – Emitted when the slider’s value changes.
sliderMoved(int) – Emitted while the slider is being dragged.
sliderReleased(int) – Emitted when the slider handle is released.
sliderPressed(int) – Emitted when the slider handle is pressed.
- Attributes:
- max_value
- min_value
- step
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)Updates the slider value from the label after editing is finished.
hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setValue(float_value)Sets the slider value.
setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])update_label(int_value)Updates the label value to display the slider's value.
updatesEnabled(self)value()Returns the current value of the slider.
visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
setTickInterval
sliderMoved
sliderPressed
sliderReleased
valueChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- property max_value#
- property min_value#
- setValue(float_value)[source]#
Sets the slider value.
- Parameters:
value (int) – Desired slider value.
- sliderMoved#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- sliderPressed#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- sliderReleased#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- property step#
- update_label(int_value)[source]#
Updates the label value to display the slider’s value.
- Parameters:
value (int) – Current value of the slider.
- value()[source]#
Returns the current value of the slider.
- Returns:
Current slider value.
- Return type:
- valueChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class common.CustomWidgets.CustomTableWidget(parent=None)[source]#
Bases:
QTableWidgetA QTableWidget subclass with extended utility functions for data extraction and conversion.
This widget supports conversion of table contents (including embedded widgets such as QLineEdit, QComboBox, QCheckBox, etc.) to a pandas DataFrame, and provides convenience methods for column-based data access. It is designed for integration with tools that dynamically populate cells with interactive widgets.
Examples
>>> widget = CustomTableWidget() >>> widget.to_dataframe() >>> widget.column_to_list(0) >>> widget.column_to_list("Sample Name")
Notes
Embedded widgets are interpreted based on their type (e.g., QLineEdit.text(), QCheckBox.isChecked()).
Additional widget types can be handled by extending extract_widget_data().
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addScrollBarWidget(self, widget, alignment)adjustSize(self)alternatingRowColors(self)autoFillBackground(self)autoScrollMargin(self)backgroundRole(self)baseSize(self)blockSignals(self, b)cellWidget(self, row, column)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clear(self)clearContents(self)clearFocus(self)clearMask(self)clearSelection(self)clearSpans(self)close(self)closeEditor(self, editor, hint)closeEvent(self, a0)closePersistentEditor(self, item)colorCount(self)column(self, item)columnAt(self, x)columnCount(self)columnCountChanged(self, oldCount, newCount)columnMoved(self, column, oldIndex, newIndex)columnResized(self, column, oldWidth, newWidth)columnSpan(self, row, column)columnViewportPosition(self, column)columnWidth(self, column)column_to_list(column)Extracts data from a specified column into a list.
commitData(self, editor)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)cornerWidget(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])currentChanged(self, current, previous)currentColumn(self)currentIndex(self)currentItem(self)currentRow(self)cursor(self)customEvent(self, a0)dataChanged(self, topLeft, bottomRight[, roles])defaultDropAction(self)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()dirtyRegionOffset(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dragDropMode(self)dragDropOverwriteMode(self)dragEnabled(self)dragEnterEvent(self, e)dragLeaveEvent(self, e)dragMoveEvent(self, e)drawFrame(self, a0)dropEvent(self, event)dropIndicatorPosition(self)dropMimeData(self, row, column, data, action)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)edit()editItem(self, item)editTriggers(self)editorDestroyed(self, editor)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, e)eventFilter(self, object, event)executeDelayedItemsLayout(self)extract_widget_data(widget)Extracts relevant data from a widget embedded in the table.
find(a0)findChild(-> QObjectT)findChildren(...)findItems(self, text, flags)focusInEvent(self, e)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, e)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameRect(self)frameShadow(self)frameShape(self)frameSize(self)frameStyle(self)frameWidth(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)gridStyle(self)hasAutoScroll(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideColumn(self, column)hideEvent(self, a0)hideRow(self, row)horizontalHeader(self)horizontalHeaderItem(self, column)horizontalOffset(self)horizontalScrollBar(self)horizontalScrollBarPolicy(self)horizontalScrollMode(self)horizontalScrollbarAction(self, action)horizontalScrollbarValueChanged(self, value)iconSize(self)indexAt(self, p)indexFromItem(self, item)indexWidget(self, index)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)initViewItemOption(self, option)inputMethodEvent(self, event)inputMethodHints(self)inputMethodQuery(self, query)insertAction(self, before, action)insertActions(self, before, actions)insertColumn(self, column)insertRow(self, row)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isColumnHidden(self, column)isCornerButtonEnabled(self)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isIndexHidden(self, index)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isPersistentEditorOpen(self, item)isQuickItemType(self)isRightToLeft(self)isRowHidden(self, row)isSignalConnected(self, signal)isSortingEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)item(self, row, column)itemAt(-> Optional[QTableWidgetItem])itemDelegate(self)itemDelegateForColumn(self, column)itemDelegateForIndex(self, index)itemDelegateForRow(self, row)itemFromIndex(self, index)itemPrototype(self)items(self, data)keyPressEvent(self, e)keyReleaseEvent(self, a0)keyboardGrabber()keyboardSearch(self, search)killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)lineWidth(self)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumViewportSize(self)maximumWidth(self)metaObject(self)metric(self, a0)midLineWidth(self)mimeData(self, items)mimeTypes(self)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)model(self)mouseDoubleClickEvent(self, e)mouseGrabber()mouseMoveEvent(self, e)mousePressEvent(self, e)mouseReleaseEvent(self, e)move(move)moveCursor(self, cursorAction, modifiers)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)openPersistentEditor(self, item)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, e)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeCellWidget(self, arow, acolumn)removeColumn(self, column)removeEventFilter(self, a0)removeRow(self, row)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)reset(self)resetHorizontalScrollMode(self)resetVerticalScrollMode(self)resize(resize)resizeColumnToContents(self, column)resizeColumnsToContents(self)resizeEvent(self, e)resizeRowToContents(self, row)resizeRowsToContents(self)restoreGeometry(self, geometry)rootIndex(self)row(self, item)rowAt(self, y)rowCount(self)rowCountChanged(self, oldCount, newCount)rowHeight(self, row)rowMoved(self, row, oldIndex, newIndex)rowResized(self, row, oldHeight, newHeight)rowSpan(self, row, column)rowViewportPosition(self, row)rowsAboutToBeRemoved(self, parent, start, end)rowsInserted(self, parent, start, end)saveGeometry(self)scheduleDelayedItemsLayout(self)screen(self)scroll(scroll)scrollBarWidgets(self, alignment)scrollContentsBy(self, dx, dy)scrollDirtyRegion(self, dx, dy)scrollTo(self, index[, hint])scrollToBottom(self)scrollToItem(self, item[, hint])scrollToTop(self)selectAll(self)selectColumn(self, column)selectRow(self, row)selectedIndexes(self)selectedItems(self)selectedRanges(self)selectionBehavior(self)selectionChanged(self, selected, deselected)selectionCommand(self, index[, event])selectionMode(self)selectionModel(self)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAlternatingRowColors(self, enable)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setAutoScroll(self, enable)setAutoScrollMargin(self, margin)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCellWidget(self, row, column, widget)setColumnCount(self, columns)setColumnHidden(self, column, hide)setColumnWidth(self, column, width)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCornerButtonEnabled(self, enable)setCornerWidget(self, widget)setCurrentCell(setCurrentCell)setCurrentIndex(self, index)setCurrentItem(setCurrentItem)setCursor(self, a0)setDefaultDropAction(self, dropAction)setDirtyRegion(self, region)setDisabled(self, a0)setDragDropMode(self, behavior)setDragDropOverwriteMode(self, overwrite)setDragEnabled(self, enable)setDropIndicatorShown(self, enable)setEditTriggers(self, triggers)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrameRect(self, a0)setFrameShadow(self, a0)setFrameShape(self, a0)setFrameStyle(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setGridStyle(self, style)setHidden(self, hidden)setHorizontalHeader(self, header)setHorizontalHeaderItem(self, column, item)setHorizontalHeaderLabels(self, labels)setHorizontalScrollBar(self, scrollbar)setHorizontalScrollBarPolicy(self, a0)setHorizontalScrollMode(self, mode)setIconSize(self, size)setIndexWidget(self, index, widget)setInputMethodHints(self, hints)setItem(self, row, column, item)setItemDelegate(self, delegate)setItemDelegateForColumn(self, column, delegate)setItemDelegateForRow(self, row, delegate)setItemPrototype(self, item)setLayout(self, a0)setLayoutDirection(self, direction)setLineWidth(self, a0)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMidLineWidth(self, a0)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModel(self, model)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setRangeSelected(self, range, select)setRootIndex(self, index)setRowCount(self, rows)setRowHeight(self, row, height)setRowHidden(self, row, hide)setScreen(self, a0)setSelection(self, rect, command)setSelectionBehavior(self, behavior)setSelectionMode(self, mode)setSelectionModel(self, selectionModel)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setShowGrid(self, show)setSizeAdjustPolicy(self, policy)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setSortingEnabled(self, enable)setSpan(self, row, column, rowSpan, columnSpan)setState(self, state)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabKeyNavigation(self, enable)setTabOrder(a0, a1)setTabletTracking(self, enable)setTextElideMode(self, mode)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVerticalHeader(self, header)setVerticalHeaderItem(self, row, item)setVerticalHeaderLabels(self, labels)setVerticalScrollBar(self, scrollbar)setVerticalScrollBarPolicy(self, a0)setVerticalScrollMode(self, mode)setViewport(self, widget)setViewportMargins(setViewportMargins)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)setWordWrap(self, on)setupViewport(self, viewport)sharedPainter(self)show(self)showColumn(self, column)showDropIndicator(self)showEvent(self, a0)showFullScreen(self)showGrid(self)showMaximized(self)showMinimized(self)showNormal(self)showRow(self, row)signalsBlocked(self)size(self)sizeAdjustPolicy(self)sizeHint(self)sizeHintForColumn(self, column)sizeHintForIndex(self, index)sizeHintForRow(self, row)sizeIncrement(self)sizePolicy(self)sortByColumn(self, column, order)sortItems(self, column[, order])stackUnder(self, a0)startDrag(self, supportedActions)startTimer(self, interval[, timerType])state(self)statusTip(self)style(self)styleSheet(self)supportedDropActions(self)tabKeyNavigation(self)tabletEvent(self, a0)takeHorizontalHeaderItem(self, column)takeItem(self, row, column)takeVerticalHeaderItem(self, row)testAttribute(self, attribute)textElideMode(self)thread(self)timerEvent(self, event)Converts the table content (including widgets) to a pandas DataFrame.
toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update)updateEditorData(self)updateEditorGeometries(self)updateGeometries(self)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)verticalHeader(self)verticalHeaderItem(self, row)verticalOffset(self)verticalScrollBar(self)verticalScrollBarPolicy(self)verticalScrollMode(self)verticalScrollbarAction(self, action)verticalScrollbarValueChanged(self, value)viewport(self)viewportEvent(self, e)viewportMargins(self)viewportSizeHint(self)visibleRegion(self)visualColumn(self, logicalColumn)visualItemRect(self, item)visualRect(self, index)visualRegionForSelection(self, selection)visualRow(self, logicalRow)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)wordWrap(self)x(self)y(self)CursorAction
DragDropMode
DropIndicatorPosition
EditTrigger
PaintDeviceMetric
RenderFlag
ScrollHint
ScrollMode
SelectionBehavior
SelectionMode
Shadow
Shape
SizeAdjustPolicy
State
StyleMask
activated
cellActivated
cellChanged
cellClicked
cellDoubleClicked
cellEntered
cellPressed
clicked
currentCellChanged
currentItemChanged
customContextMenuRequested
destroyed
doubleClicked
entered
iconSizeChanged
itemActivated
itemChanged
itemClicked
itemDoubleClicked
itemEntered
itemPressed
itemSelectionChanged
objectNameChanged
pressed
viewportEntered
windowIconChanged
windowIconTextChanged
windowTitleChanged
- column_to_list(column)[source]#
Extracts data from a specified column into a list.
- Parameters:
column (int or str) – Column index (int) or column header name (str).
- Returns:
A list of cell values from the specified column.
- Return type:
- Raises:
ValueError – If the specified column name or index is not found.
- class common.CustomWidgets.CustomToolBox(parent=None)[source]#
Bases:
QToolBoxMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addItem(-> int)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)count(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])currentIndex(self)currentWidget(self)cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)drawFrame(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, e)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameRect(self)frameShadow(self)frameShape(self)frameSize(self)frameStyle(self)frameWidth(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)indexOf(self, widget)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)insertItem(-> int)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isItemEnabled(self, index)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)itemIcon(self, index)itemInserted(self, index)itemRemoved(self, index)itemText(self, index)itemToolTip(self, index)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)lineWidth(self)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)midLineWidth(self)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)removeItem(self, index)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCurrentIndex(self, index)setCurrentWidget(self, widget)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrameRect(self, a0)setFrameShadow(self, a0)setFrameShape(self, a0)setFrameStyle(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setItemEnabled(self, index, enabled)setItemIcon(self, index, icon)setItemText(self, index, text)setItemToolTip(self, index, toolTip)setLayout(self, a0)setLayoutDirection(self, direction)setLineWidth(self, a0)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMidLineWidth(self, a0)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_page_icons(page_text, light_icon, dark_icon)Assign icons for a given page.
set_theme(theme)Set current theme and update all icons.
sharedPainter(self)show(self)showEvent(self, e)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])update_icon(page_text)Update a single page icon based on current theme.
Update all page icons to match the current theme.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self, index)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
Shadow
Shape
StyleMask
currentChanged
customContextMenuRequested
destroyed
objectNameChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CustomWidgets.CustomToolButton(text: str, light_icon_unchecked: str, light_icon_checked: str | None = None, dark_icon_unchecked: str | None = None, dark_icon_checked: str | None = None, button_size: int = 32, icon_size: int = 26, parent=None)[source]#
Bases:
QToolButtonA button that changes icons when checked or the theme changes from light to dark
- self._light_icon_unchecked#
Icon for light, unchecked state
- Type:
QIcon
- self._light_icon_checked#
Icon for light, checked state
- Type:
QIcon
- self._dark_icon_unchecked#
Icon for dark, unchecked state
- Type:
QIcon
- self._dark_icon_checked#
Icon for dark, checked state
- Type:
QIcon
- Parameters:
light_icon_unchecked (str) – Unchecked icon filename for light color theme.
light_icon_checked (str | None) – Checked icon filename for light color theme. If None, the icon is not checkable
dark_icon_unchecked (str) – Unchecked icon filename for dark color theme.
dark_icon_checked (str | None) – Checked icon filename for dark color theme. If None, the icon is not checkable
button_size (int) – Size of button in pt.
icon_size (int) – Size of icon on button in pt.
parent (QToolButton) – Tool button to set icons.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)animateClick(self)arrowType(self)autoExclusive(self)autoFillBackground(self)autoRaise(self)autoRepeat(self)autoRepeatDelay(self)autoRepeatInterval(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)checkStateSet(self)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)click(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)defaultAction(self)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, a0)event(self, e)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, e)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, e)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)group(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)hitButton(self, pos)icon(self)iconSize(self)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isCheckable(self)isChecked(self)isDown(self)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, e)keyReleaseEvent(self, e)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)menu(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, e)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextCheckState(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)popupMode(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setArrowType(self, type)setAttribute(self, attribute[, on])setAutoExclusive(self, a0)setAutoFillBackground(self, enabled)setAutoRaise(self, enable)setAutoRepeat(self, a0)setAutoRepeatDelay(self, a0)setAutoRepeatInterval(self, a0)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCheckable(self, a0)setChecked(self, a0)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDefaultAction(self, a0)setDisabled(self, a0)setDown(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setIcon(self, icon)setIconSize(self, size)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMenu(self, menu)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setPopupMode(self, mode)setProperty(self, name, value)setScreen(self, a0)setShortcut(self, key)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setText(self, text)setToolButtonStyle(self, style)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_theme(theme)Updates the icon to light/dark theme.
sharedPainter(self)shortcut(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMenu(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)text(self)thread(self)timerEvent(self, a0)toggle(self)toolButtonStyle(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Update the icon based on the button's checked state and theme.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
ToolButtonPopupMode
clicked
customContextMenuRequested
destroyed
objectNameChanged
pressed
released
toggled
triggered
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.CustomWidgets.CustomTreeView(parent=None)[source]#
Bases:
QTreeViewA customized QTreeView widget for managing a hierarchical tree structure.
Provides functionality to create branches and leaves in a QStandardItemModel-based tree, search for items, retrieve paths and associated data, sort branches, and handle UI events.
- treeModel#
The data model used for the tree.
- Type:
QStandardItemModel
- root_node#
The invisible root node of the tree model.
- Type:
QStandardItem
- Parameters:
parent (QWidget, optional) – The parent widget, by default None.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addScrollBarWidget(self, widget, alignment)add_branch(parent_item, branch_name[, data])Add a new branch to the tree under the specified parent.
add_leaf(branch_item, leaf_name[, data])Add a new leaf to a branch.
adjustSize(self)allColumnsShowFocus(self)alternatingRowColors(self)autoExpandDelay(self)autoFillBackground(self)autoScrollMargin(self)backgroundRole(self)baseSize(self)blockSignals(self, b)branch_exists(parent_item, branch_name)Check if a branch with a given name exists under the specified parent item.
changeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)clearSelection(self)Clears all items from the tree model.
close(self)closeEditor(self, editor, hint)closeEvent(self, a0)closePersistentEditor(self, index)collapse(self, index)collapseAll(self)colorCount(self)columnAt(self, x)columnCountChanged(self, oldCount, newCount)columnMoved(self)columnResized(self, column, oldSize, newSize)columnViewportPosition(self, column)columnWidth(self, column)commitData(self, editor)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)cornerWidget(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])currentChanged(self, current, previous)currentIndex(self)cursor(self)customEvent(self, a0)dataChanged(self, topLeft, bottomRight[, roles])defaultDropAction(self)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()dirtyRegionOffset(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dragDropMode(self)dragDropOverwriteMode(self)dragEnabled(self)dragEnterEvent(self, e)dragLeaveEvent(self, e)dragMoveEvent(self, event)drawBranches(self, painter, rect, index)drawFrame(self, a0)drawRow(self, painter, options, index)drawTree(self, painter, region)dropEvent(self, e)dropIndicatorPosition(self)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)edit()editTriggers(self)editorDestroyed(self, editor)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, object, event)executeDelayedItemsLayout(self)expand(self, index)expandAll(self)expandRecursively(self, index[, depth])expandToDepth(self, depth)expandsOnDoubleClick(self)find(a0)findChild(-> QObjectT)findChildren(...)find_leaf(branch_item, leaf_name)Find a leaf under a branch by its name.
focusInEvent(self, e)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, e)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameRect(self)frameShadow(self)frameShape(self)frameSize(self)frameStyle(self)frameWidth(self)geometry(self)get_item_path(item)Return the full path of an item as a list from root to the given item.
get_leaf_data(leaf_item)Return the full path of an item as a list from root to the given item.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasAutoScroll(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)header(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideColumn(self, column)hideEvent(self, a0)horizontalOffset(self)horizontalScrollBar(self)horizontalScrollBarPolicy(self)horizontalScrollMode(self)horizontalScrollbarAction(self, action)horizontalScrollbarValueChanged(self, value)iconSize(self)indentation(self)indexAbove(self, index)indexAt(self, p)indexBelow(self, index)indexRowSizeHint(self, index)indexWidget(self, index)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)initViewItemOption(self, option)inputMethodEvent(self, event)inputMethodHints(self)inputMethodQuery(self, query)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAnimated(self)isColumnHidden(self, column)isEnabled(self)isEnabledTo(self, a0)isExpanded(self, index)isFirstColumnSpanned(self, row, parent)isFullScreen(self)isHeaderHidden(self)isHidden(self)isIndexHidden(self, index)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isPersistentEditorOpen(self, index)isQuickItemType(self)isRightToLeft(self)isRowHidden(self, row, parent)isSignalConnected(self, signal)isSortingEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)itemDelegate(self)itemDelegateForColumn(self, column)itemDelegateForIndex(self, index)itemDelegateForRow(self, row)itemsExpandable(self)keyPressEvent(self, event)keyReleaseEvent(self, a0)keyboardGrabber()keyboardSearch(self, search)killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)lineWidth(self)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumViewportSize(self)maximumWidth(self)metaObject(self)metric(self, a0)midLineWidth(self)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)model(self)mouseDoubleClickEvent(self, e)mouseGrabber()mouseMoveEvent(self, event)mousePressEvent(self, e)mouseReleaseEvent(self, event)move(move)moveCursor(self, cursorAction, modifiers)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)on_double_click(index)Handle a double-click event on an item in the tree.
openPersistentEditor(self, index)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, e)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)reexpand(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)reset(self)resetHorizontalScrollMode(self)resetIndentation(self)resetVerticalScrollMode(self)resize(resize)resizeColumnToContents(self, column)resizeEvent(self, e)restoreGeometry(self, geometry)rootIndex(self)rootIsDecorated(self)rowHeight(self, index)rowsAboutToBeRemoved(self, parent, start, end)rowsInserted(self, parent, start, end)rowsRemoved(self, parent, first, last)saveGeometry(self)scheduleDelayedItemsLayout(self)screen(self)scroll(scroll)scrollBarWidgets(self, alignment)scrollContentsBy(self, dx, dy)scrollDirtyRegion(self, dx, dy)scrollTo(self, index[, hint])scrollToBottom(self)scrollToTop(self)selectAll(self)selectedIndexes(self)selectionBehavior(self)selectionChanged(self, selected, deselected)selectionCommand(self, index[, event])selectionMode(self)selectionModel(self)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllColumnsShowFocus(self, enable)setAlternatingRowColors(self, enable)setAnimated(self, enable)setAttribute(self, attribute[, on])setAutoExpandDelay(self, delay)setAutoFillBackground(self, enabled)setAutoScroll(self, enable)setAutoScrollMargin(self, margin)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setColumnHidden(self, column, hide)setColumnWidth(self, column, width)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCornerWidget(self, widget)setCurrentIndex(self, index)setCursor(self, a0)setDefaultDropAction(self, dropAction)setDirtyRegion(self, region)setDisabled(self, a0)setDragDropMode(self, behavior)setDragDropOverwriteMode(self, overwrite)setDragEnabled(self, enable)setDropIndicatorShown(self, enable)setEditTriggers(self, triggers)setEnabled(self, a0)setExpanded(self, index, expand)setExpandsOnDoubleClick(self, enable)setFirstColumnSpanned(self, row, parent, span)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrameRect(self, a0)setFrameShadow(self, a0)setFrameShape(self, a0)setFrameStyle(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHeader(self, header)setHeaderHidden(self, hide)setHidden(self, hidden)setHorizontalScrollBar(self, scrollbar)setHorizontalScrollBarPolicy(self, a0)setHorizontalScrollMode(self, mode)setIconSize(self, size)setIndentation(self, i)setIndexWidget(self, index, widget)setInputMethodHints(self, hints)setItemDelegate(self, delegate)setItemDelegateForColumn(self, column, delegate)setItemDelegateForRow(self, row, delegate)setItemsExpandable(self, enable)setLayout(self, a0)setLayoutDirection(self, direction)setLineWidth(self, a0)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMidLineWidth(self, a0)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModel(self, model)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setRootIndex(self, index)setRootIsDecorated(self, show)setRowHidden(self, row, parent, hide)setScreen(self, a0)setSelection(self, rect, command)setSelectionBehavior(self, behavior)setSelectionMode(self, mode)setSelectionModel(self, selectionModel)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeAdjustPolicy(self, policy)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setSortingEnabled(self, enable)setState(self, state)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabKeyNavigation(self, enable)setTabOrder(a0, a1)setTabletTracking(self, enable)setTextElideMode(self, mode)setToolTip(self, a0)setToolTipDuration(self, msec)setTreePosition(self, logicalIndex)setUniformRowHeights(self, uniform)setUpdatesEnabled(self, enable)setVerticalScrollBar(self, scrollbar)setVerticalScrollBarPolicy(self, a0)setVerticalScrollMode(self, mode)setViewport(self, widget)setViewportMargins(setViewportMargins)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)setWordWrap(self, on)setupViewport(self, viewport)sharedPainter(self)show(self)showColumn(self, column)showDropIndicator(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeAdjustPolicy(self)sizeHint(self)sizeHintForColumn(self, column)sizeHintForIndex(self, index)sizeHintForRow(self, row)sizeIncrement(self)sizePolicy(self)sortByColumn(self, column, order)sort_branch(branch, order_list)Sorts a branch in the treeView given an ordered list.
stackUnder(self, a0)startDrag(self, supportedActions)startTimer(self, interval[, timerType])state(self)statusTip(self)style(self)styleSheet(self)tabKeyNavigation(self)tabletEvent(self, a0)testAttribute(self, attribute)textElideMode(self)thread(self)timerEvent(self, event)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])treePosition(self)underMouse(self)ungrabGesture(self, type)uniformRowHeights(self)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update)updateEditorData(self)updateEditorGeometries(self)updateGeometries(self)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)verticalOffset(self)verticalScrollBar(self)verticalScrollBarPolicy(self)verticalScrollMode(self)verticalScrollbarAction(self, action)verticalScrollbarValueChanged(self, value)viewport(self)viewportEvent(self, event)viewportMargins(self)viewportSizeHint(self)visibleRegion(self)visualRect(self, index)visualRegionForSelection(self, selection)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)wordWrap(self)x(self)y(self)CursorAction
DragDropMode
DropIndicatorPosition
EditTrigger
PaintDeviceMetric
RenderFlag
ScrollHint
ScrollMode
SelectionBehavior
SelectionMode
Shadow
Shape
SizeAdjustPolicy
State
StyleMask
activated
clicked
collapsed
customContextMenuRequested
destroyed
doubleClicked
entered
expanded
iconSizeChanged
objectNameChanged
pressed
viewportEntered
windowIconChanged
windowIconTextChanged
windowTitleChanged
- add_branch(parent_item, branch_name, data=None)[source]#
Add a new branch to the tree under the specified parent.
- Parameters:
parent_item (QStandardItem) – The parent item to add the branch to.
branch_name (str) – The name of the new branch.
data (any, optional) – Optional data to associate with the branch.
- Returns:
The created branch item.
- Return type:
QStandardItem
- add_leaf(branch_item, leaf_name, data=None)[source]#
Add a new leaf to a branch.
- Parameters:
branch_item (QStandardItem) – The branch item to which the leaf will be added.
leaf_name (str) – The name of the new leaf.
data (any, optional) – Optional data to associate with the leaf.
- Returns:
The created leaf item.
- Return type:
QStandardItem
- branch_exists(parent_item, branch_name)[source]#
Check if a branch with a given name exists under the specified parent item.
- Parameters:
parent_item (QStandardItem) – The item to search under.
branch_name (str) – The name of the branch to look for.
- Returns:
The branch item if found, otherwise None.
- Return type:
QStandardItem or None
- find_leaf(branch_item, leaf_name)[source]#
Find a leaf under a branch by its name.
- Parameters:
branch_item (QStandardItem) – The branch item to search within.
leaf_name (str) – The name of the leaf to find.
- Returns:
The leaf item if found, otherwise None.
- Return type:
QStandardItem or None
- get_leaf_data(leaf_item)[source]#
Return the full path of an item as a list from root to the given item.
- class common.CustomWidgets.DoubleSlider(min_value=0, max_value=100, step=1, initial_left=25, initial_right=75, parent=None)[source]#
Bases:
QWidgetA dual-slider widget with editable input fields for setting a value range.
This widget features two horizontal QSliders for setting a minimum and maximum value, along with associated QLineEdits to allow manual text input. It emits combined signals when either slider changes, is moved, or released.
- Parameters:
min_value (int, optional) – Minimum allowed slider value (default is 0).
max_value (int, optional) – Maximum allowed slider value (default is 100).
step (int, optional) – Step size between values (default is 1).
initial_left (int, optional) – Initial value for the left (lower) slider (default is 25).
initial_right (int, optional) – Initial value for the right (upper) slider (default is 75).
parent (QWidget, optional) – Parent widget (default is None).
- Signals:
valueChanged(int, int) – Emitted when either slider value changes.
sliderMoved(int, int) – Emitted while either slider is being dragged.
sliderReleased(int, int) – Emitted when either slider handle is released.
sliderPressed(int, int) – Emitted when either slider handle is pressed.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLeftValue(value)Sets the value of the left slider.
setLocale(self, locale)setMask(setMask)setMaximum(value)Sets the maximum value for both sliders.
setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimum(value)Sets the minimum value for both sliders.
setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setRightValue(value)Sets the value of the right slider.
setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStep(value)Sets the step size for both sliders.
setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setValues(values)Sets values for both sliders.
setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Updates slider values based on text input in the line edits.
Updates the line edits to reflect the slider values and emits the valueChanged signal.
updatesEnabled(self)values()Returns the current values of both sliders.
visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
sliderMoved
sliderPressed
sliderReleased
valueChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- setLeftValue(value)[source]#
Sets the value of the left slider.
- Parameters:
value (int) – Desired value for the left slider.
- setMaximum(value)[source]#
Sets the maximum value for both sliders.
- Parameters:
value (int) – Maximum value.
- setMinimum(value)[source]#
Sets the minimum value for both sliders.
- Parameters:
value (int) – Minimum value.
- setRightValue(value)[source]#
Sets the value of the right slider.
- Parameters:
value (int) – Desired value for the right slider.
- sliderMoved#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- sliderPressed#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- sliderReleased#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- update_sliders()[source]#
Updates slider values based on text input in the line edits. Invalid input is ignored.
- update_values()[source]#
Updates the line edits to reflect the slider values and emits the valueChanged signal.
- valueChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- class common.CustomWidgets.RotatedHeaderView(parent=None)[source]#
Bases:
QHeaderViewA custom QHeaderView that displays horizontal headers rotated by 90 degrees.
This header view is useful for tables with many columns where horizontal space is constrained. It transposes the size hint and rotates the header text during painting to display the headers vertically.
- Parameters:
parent (QWidget, optional) – The parent widget (typically a QTableView).
- orientation#
The orientation of the header view. Fixed to Qt.Horizontal.
- Type:
Qt.Orientation
- sectionSizeFromContents(logicalIndex)[source]#
Returns the transposed section size to accommodate vertical text.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addScrollBarWidget(self, widget, alignment)adjustSize(self)alternatingRowColors(self)autoFillBackground(self)autoScrollMargin(self)backgroundRole(self)baseSize(self)blockSignals(self, b)cascadingSectionResizes(self)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)clearSelection(self)close(self)closeEditor(self, editor, hint)closeEvent(self, a0)closePersistentEditor(self, index)colorCount(self)commitData(self, editor)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)cornerWidget(self)count(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])currentChanged(self, current, old)currentIndex(self)cursor(self)customEvent(self, a0)dataChanged(self, topLeft, bottomRight[, roles])defaultAlignment(self)defaultDropAction(self)defaultSectionSize(self)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()dirtyRegionOffset(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dragDropMode(self)dragDropOverwriteMode(self)dragEnabled(self)dragEnterEvent(self, e)dragLeaveEvent(self, e)dragMoveEvent(self, e)drawFrame(self, a0)dropEvent(self, e)dropIndicatorPosition(self)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)edit()editTriggers(self)editorDestroyed(self, editor)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, e)eventFilter(self, object, event)executeDelayedItemsLayout(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, e)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, e)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameRect(self)frameShadow(self)frameShape(self)frameSize(self)frameStyle(self)frameWidth(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasAutoScroll(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)headerDataChanged(self, orientation, ...)height(self)heightForWidth(self, a0)heightMM(self)hiddenSectionCount(self)hide(self)hideEvent(self, a0)hideSection(self, alogicalIndex)highlightSections(self)horizontalOffset(self)horizontalScrollBar(self)horizontalScrollBarPolicy(self)horizontalScrollMode(self)horizontalScrollbarAction(self, action)horizontalScrollbarValueChanged(self, value)iconSize(self)indexAt(self, p)indexWidget(self, index)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)initStyleOptionForIndex(self, option, ...)initViewItemOption(self, option)initialize(self)initializeSections(initializeSections)inputMethodEvent(self, event)inputMethodHints(self)inputMethodQuery(self, query)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFirstSectionMovable(self)isFullScreen(self)isHidden(self)isIndexHidden(self, index)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isPersistentEditorOpen(self, index)isQuickItemType(self)isRightToLeft(self)isSectionHidden(self, logicalIndex)isSignalConnected(self, signal)isSortIndicatorClearable(self)isSortIndicatorShown(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)itemDelegate(self)itemDelegateForColumn(self, column)itemDelegateForIndex(self, index)itemDelegateForRow(self, row)keyPressEvent(self, e)keyReleaseEvent(self, a0)keyboardGrabber()keyboardSearch(self, search)killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)length(self)lineWidth(self)locale(self)logicalDpiX(self)logicalDpiY(self)logicalIndex(self, visualIndex)logicalIndexAt(-> int -> int)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSectionSize(self)maximumSize(self)maximumViewportSize(self)maximumWidth(self)metaObject(self)metric(self, a0)midLineWidth(self)minimumHeight(self)minimumSectionSize(self)minimumSize(self)Return the minimum size hint for the header.
minimumWidth(self)model(self)mouseDoubleClickEvent(self, e)mouseGrabber()mouseMoveEvent(self, e)mousePressEvent(self, e)mouseReleaseEvent(self, e)move(move)moveCursor(self, a0, a1)moveEvent(self, a0)moveSection(self, from_, to)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)offset(self)openPersistentEditor(self, index)orientation(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, e)paintSection(painter, rect, logicalIndex)Paint a single section of the header, rotating the text by -90 degrees.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)reset(self)resetDefaultSectionSize(self)resetHorizontalScrollMode(self)resetVerticalScrollMode(self)resize(resize)resizeContentsPrecision(self)resizeEvent(self, e)resizeSection(self, logicalIndex, size)resizeSections(resizeSections)restoreGeometry(self, geometry)restoreState(self, state)rootIndex(self)rowsAboutToBeRemoved(self, parent, start, end)rowsInserted(self, parent, start, end)saveGeometry(self)saveState(self)scheduleDelayedItemsLayout(self)screen(self)scroll(scroll)scrollBarWidgets(self, alignment)scrollContentsBy(self, dx, dy)scrollDirtyRegion(self, dx, dy)scrollTo(self, index, hint)scrollToBottom(self)scrollToTop(self)sectionPosition(self, logicalIndex)sectionResizeMode(self, logicalIndex)sectionSize(self, logicalIndex)sectionSizeFromContents(logicalIndex)Return the size of a section, adjusted for rotated text.
sectionSizeHint(self, logicalIndex)sectionViewportPosition(self, logicalIndex)sectionsAboutToBeRemoved(self, parent, ...)sectionsClickable(self)sectionsHidden(self)sectionsInserted(self, parent, logicalFirst, ...)sectionsMovable(self)sectionsMoved(self)selectAll(self)selectedIndexes(self)selectionBehavior(self)selectionChanged(self, selected, deselected)selectionCommand(self, index[, event])selectionMode(self)selectionModel(self)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAlternatingRowColors(self, enable)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setAutoScroll(self, enable)setAutoScrollMargin(self, margin)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCascadingSectionResizes(self, enable)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCornerWidget(self, widget)setCurrentIndex(self, index)setCursor(self, a0)setDefaultAlignment(self, alignment)setDefaultDropAction(self, dropAction)setDefaultSectionSize(self, size)setDirtyRegion(self, region)setDisabled(self, a0)setDragDropMode(self, behavior)setDragDropOverwriteMode(self, overwrite)setDragEnabled(self, enable)setDropIndicatorShown(self, enable)setEditTriggers(self, triggers)setEnabled(self, a0)setFirstSectionMovable(self, movable)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setFrameRect(self, a0)setFrameShadow(self, a0)setFrameShape(self, a0)setFrameStyle(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setHighlightSections(self, highlight)setHorizontalScrollBar(self, scrollbar)setHorizontalScrollBarPolicy(self, a0)setHorizontalScrollMode(self, mode)setIconSize(self, size)setIndexWidget(self, index, widget)setInputMethodHints(self, hints)setItemDelegate(self, delegate)setItemDelegateForColumn(self, column, delegate)setItemDelegateForRow(self, row, delegate)setLayout(self, a0)setLayoutDirection(self, direction)setLineWidth(self, a0)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSectionSize(self, size)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMidLineWidth(self, a0)setMinimumHeight(self, minh)setMinimumSectionSize(self, size)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModel(self, model)setMouseTracking(self, enable)setObjectName(self, name)setOffset(self, offset)setOffsetToLastSection(self)setOffsetToSectionPosition(self, visualIndex)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setResizeContentsPrecision(self, precision)setRootIndex(self, index)setScreen(self, a0)setSectionHidden(self, logicalIndex, hide)setSectionResizeMode(setSectionResizeMode)setSectionsClickable(self, clickable)setSectionsMovable(self, movable)setSelection(self, rect, flags)setSelectionBehavior(self, behavior)setSelectionMode(self, mode)setSelectionModel(self, selectionModel)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeAdjustPolicy(self, policy)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setSortIndicator(self, logicalIndex, order)setSortIndicatorClearable(self, clearable)setSortIndicatorShown(self, show)setState(self, state)setStatusTip(self, a0)setStretchLastSection(self, stretch)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabKeyNavigation(self, enable)setTabOrder(a0, a1)setTabletTracking(self, enable)setTextElideMode(self, mode)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVerticalScrollBar(self, scrollbar)setVerticalScrollBarPolicy(self, a0)setVerticalScrollMode(self, mode)setViewport(self, widget)setViewportMargins(setViewportMargins)setVisible(self, v)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)setupViewport(self, viewport)sharedPainter(self)show(self)showDropIndicator(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)showSection(self, alogicalIndex)signalsBlocked(self)size(self)sizeAdjustPolicy(self)sizeHint(self)sizeHintForColumn(self, column)sizeHintForIndex(self, index)sizeHintForRow(self, row)sizeIncrement(self)sizePolicy(self)sortIndicatorOrder(self)sortIndicatorSection(self)stackUnder(self, a0)startDrag(self, supportedActions)startTimer(self, interval[, timerType])state(self)statusTip(self)stretchLastSection(self)stretchSectionCount(self)style(self)styleSheet(self)swapSections(self, first, second)tabKeyNavigation(self)tabletEvent(self, a0)testAttribute(self, attribute)textElideMode(self)thread(self)timerEvent(self, e)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update)updateEditorData(self)updateEditorGeometries(self)updateGeometries(self)updateGeometry(self)updateMicroFocus(self[, query])updateSection(self, logicalIndex)updatesEnabled(self)verticalOffset(self)verticalScrollBar(self)verticalScrollBarPolicy(self)verticalScrollMode(self)verticalScrollbarAction(self, action)verticalScrollbarValueChanged(self, value)viewport(self)viewportEvent(self, e)viewportMargins(self)viewportSizeHint(self)visibleRegion(self)visualIndex(self, logicalIndex)visualIndexAt(self, position)visualRect(self, index)visualRegionForSelection(self, selection)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)CursorAction
DragDropMode
DropIndicatorPosition
EditTrigger
PaintDeviceMetric
RenderFlag
ResizeMode
ScrollHint
ScrollMode
SelectionBehavior
SelectionMode
Shadow
Shape
SizeAdjustPolicy
State
StyleMask
activated
clicked
customContextMenuRequested
destroyed
doubleClicked
entered
geometriesChanged
iconSizeChanged
objectNameChanged
pressed
sectionClicked
sectionCountChanged
sectionDoubleClicked
sectionEntered
sectionHandleDoubleClicked
sectionMoved
sectionPressed
sectionResized
sortIndicatorChanged
sortIndicatorClearableChanged
viewportEntered
windowIconChanged
windowIconTextChanged
windowTitleChanged
- minimumSizeHint()[source]#
Return the minimum size hint for the header.
- Returns:
The minimum size hint, transposed due to rotation.
- Return type:
QSize
- paintSection(painter, rect, logicalIndex)[source]#
Paint a single section of the header, rotating the text by -90 degrees.
- Parameters:
painter (QPainter) – The painter used to draw the section.
rect (QRect) – The bounding rectangle of the section.
logicalIndex (int) – The index of the section being painted.
- class common.CustomWidgets.StandardItem(txt='', font_size=10, set_bold=False, data=None)[source]#
Bases:
QStandardItemExtends properties of QStandardItem for QTreeView and QList items.
- Parameters:
Methods
accessibleDescription(self)accessibleText(self)appendColumn(self, items)appendRow(appendRow)appendRows(self, items)background(self)checkState(self)child(self, row[, column])clearData(self)clone(self)column(self)columnCount(self)data(self[, role])emitDataChanged(self)flags(self)font(self)foreground(self)hasChildren(self)icon(self)index(self)insertColumn(self, column, items)insertColumns(self, column, count)insertRow(insertRow)insertRows(insertRows)isAutoTristate(self)isCheckable(self)isDragEnabled(self)isDropEnabled(self)isEditable(self)isEnabled(self)isSelectable(self)isUserTristate(self)model(self)parent(self)read(self, in_)removeColumn(self, column)removeColumns(self, column, count)removeRow(self, row)removeRows(self, row, count)row(self)rowCount(self)setAccessibleDescription(self, ...)setAccessibleText(self, aaccessibleText)setAutoTristate(self, tristate)setBackground(self, abrush)setCheckState(self, acheckState)setCheckable(self, checkable)setChild(setChild)setColumnCount(self, columns)setData(self, value[, role])setDragEnabled(self, dragEnabled)setDropEnabled(self, dropEnabled)setEditable(self, editable)setEnabled(self, enabled)setFlags(self, flags)setFont(self, afont)setForeground(self, abrush)setIcon(self, aicon)setRowCount(self, rows)setSelectable(self, selectable)setSizeHint(self, asizeHint)setStatusTip(self, astatusTip)setText(self, atext)setTextAlignment(self, atextAlignment)setToolTip(self, atoolTip)setUserTristate(self, tristate)setWhatsThis(self, awhatsThis)sizeHint(self)sortChildren(self, column[, order])statusTip(self)takeChild(self, row[, column])takeColumn(self, column)takeRow(self, row)text(self)textAlignment(self)toolTip(self)type(self)whatsThis(self)write(self, out)ItemType
- class common.CustomWidgets.ToggleSwitch(parent=None, height=24, duration=100, fg_color='#f0f0f0', bg_left_color='#ffffff', bg_right_color='#478ae4')[source]#
Bases:
QWidgetA custom toggle switch widget with animated transitions and customizable colors.
This widget mimics a modern on/off switch, commonly used in mobile and web UIs. It supports smooth animated transitions between the “on” and “off” states, emits a signal when toggled, and provides optional customization for height, animation duration, and colors.
- Parameters:
parent (QWidget, optional) – The parent widget, by default None.
height (int, optional) – Height of the toggle switch. The width is automatically set to twice the height. Default is 24.
duration (int, optional) – Duration of the toggle animation in milliseconds. Default is 100.
fg_color (str, optional) – Foreground color (thumb/slider) in hex format. Default is “#f0f0f0”.
bg_left_color (str, optional) – Background color when the switch is in the “off” position. Default is “#ffffff”.
bg_right_color (str, optional) – Background color when the switch is in the “on” position. Default is “#478ae4”.
- Signals:
stateChanged (bool) – Emitted when the switch state changes.
- Attributes:
- thumb_pos
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)Returns the thumb position.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)Return the current state of the toggle switch.
isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(event)Handles mouse press events to toggle the switch state when clicked.
mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(event)Draw the toggle switch.
paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setChecked(checked)Sets the checked state of the toggle switch and triggers the animation
setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)set_thumb_pos(pos)Sets the thumb position.
sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint()Returns the size of the toggle switch.
sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toggle()Toggle switch state and emit signal
toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
stateChanged
thumb_pos
windowIconChanged
windowIconTextChanged
windowTitleChanged
- isChecked() bool[source]#
Return the current state of the toggle switch.
- Returns:
Returns checked state of the toggle switch
- Return type:
- mousePressEvent(event)[source]#
Handles mouse press events to toggle the switch state when clicked.
If the left mouse button is pressed, this method toggles the checked state of the switch.
- Parameters:
event (QMouseEvent) – The mouse event triggered by the user interaction.
- paintEvent(event)[source]#
Draw the toggle switch.
Draws the toggle switch.
- Parameters:
event (QEvent)
- setChecked(checked: bool)[source]#
Sets the checked state of the toggle switch and triggers the animation
- Parameters:
checked (bool) – New check state of the toggle switch.
- sizeHint()[source]#
Returns the size of the toggle switch.
- Returns:
size – Returns the size of the toggle switch.
- Return type:
QSize
- stateChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
- thumb_pos#
- pyqtProperty(type, fget=None, fset=None, freset=None, fdel=None, doc=None,
designable=True, scriptable=True, stored=True, user=False, constant=False, final=False, notify=None, revision=0) -> property attribute
type is the type of the property. It is either a type object or a string that is the name of a C++ type. freset is a function for resetting an attribute to its default value. designable sets the DESIGNABLE flag (the default is True for writable properties and False otherwise). scriptable sets the SCRIPTABLE flag. stored sets the STORED flag. user sets the USER flag. constant sets the CONSTANT flag. final sets the FINAL flag. notify is the NOTIFY signal. revision is the REVISION. The other parameters are the same as those required by the standard Python property type. Properties defined using pyqtProperty behave as both Python and Qt properties. Decorators can be used to define new properties or to modify existing ones.
- class common.CustomWidgets.VisibilityWidget[source]#
Bases:
QWidgetMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- visibilityChanged#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
common.DataHandling module#
- class common.DataHandling.LaserSampleObj(sample_id, file_path, outlier_method, negative_method, smoothing_method=None, ref_chem=None, ui=None)[source]#
Bases:
SampleObj- Attributes:
apply_outlier_to_allbool : flag that indicates whether the outlier method should be applied to all analytes.
array_sizetuple : (int, int) Size of map in pixels
aspect_ratiofloat : Aspect ratio of maps (dy / dx).
- auto_scale_value
crop_masknumpy.ndarray: Boolean mask used to crop the raw data. True values will be used.
current_fieldstr :
data_max_diff_quantilefloat : maximum quantile for differences used for autoscaling.
data_max_quantilefloat : maximum quantile used for autoscaling.
data_min_diff_quantilefloat : minimum quantile for differences used for autoscaling.
data_min_quantilefloat : minimum quantile used for autoscaling.
dxfloat : Width of pixels in x-direction.
dyfloat : Width of pixels in y-direction.
negative_methodstr : Method for negative handling.
- nx
- ny
outlier_methodstr : Method for predicting and clipping outliers.
ref_chemdict : Reference chemistry
valid_data_typeslist : data types possible for in processed_data.
xnumpy.ndarray : Value of x-coordinate associated with map data
x_rangefloat : Range of pixels in x-direction.
xlimlist : (float, float) Limits of pixels in x-direction.
ynumpy.ndarray : Value of y-coordinate associated with map data
y_rangefloat : Range of pixels in y-direction.
ylimlist : (float, float) Limits of pixels in y-direction.
Methods
add_columns(data_type, column_names, array)Add one or more columns to the sample object.
add_observer(event_name, callback)Register a callback function to be called when a property changes.
Applies filters based on field values.
auto_scale(sample_id, field[, update])Auto-scales pixel values in map
clip_outliers(array, outlier_method[, pl, ...])Attempts to remove outliers to by a method selected by the user.
Clusters data for use with data preprocessing
compute_ratio(analyte_1, analyte_2)Compute a ratio field from two analytes.
A simple dialog that ensures the user wishes to reset data
create_label(column_name)Creates a default label for axes.
delete_column(column_name)Deletes a column and associated attributes from the AttributeDataFrame.
get_map_data(field[, field_type, norm, ...])Retrieves and processes the mapping data for the given sample and analytes
Gets the processed data for analysis
get_vector(field_type, field[, norm, processed])Creates a dictionary of values for plotting
k_optimal_clusters(data[, max_clusters])Predicts the optimal number of clusters.
notify_observers(event_name, *args, **kwargs)Notify all registered observers of an event or property change.
prep_data([field])Applies adjustments to data data prior to analyses and plotting.
remove_observer(event_name, callback)Deregister a callback function from an event.
Reset the data to the original bounds.
Reverts back to the original data.
Resets processed_data back to raw before performing autoscaling.
Resets dx and dy to initial values.
scale_options([plot_type, ax, field_type, field])list : options for scaling the data.
sort_data(method)Sorts analyte columns in the raw and processed data according to the specified method.
Swaps DX and DY for a dataframe, updates X and Y
swap_xy()Swaps data in a SampleObj.
transform_array(array, negative_method)Negative and zero handling with clustering for noise detection.
update_norm([norm, field])Update the norm of the data.
update_resolution(axis, value)Updates DX and DY for a dataframe
- add_columns(data_type, column_names, array, mask=None)#
Add one or more columns to the sample object.
Adds one or more columns to SampleObj.processed_data. If a mask is provided, the data is placed in the correct rows based on the mask.
- Parameters:
data_type (str) – The type of data stored in the columns.
column_names (str or list of str) – The name or names of the columns to add. If a column already exists, it will be overwritten.
array (numpy.ndarray) – A 1D array (for single column) or 2D array (for multiple columns). The data to be added.
mask (numpy.ndarray, optional) – A boolean mask that indicates which rows in the original data should be filled. If not provided, the length of array must match the height of processed_data.
- Returns:
Returns a message if a column is overwritten, or a dictionary with column names as keys and “overwritten” or “added” as values if multiple columns are added.
- Return type:
- Raises:
ValueError – Valid types are given in SampleObj._valid_data_types.
ValueError – The number of columns in the array must match the length of column_names (if multiple columns are being added).
ValueError – The length of array must match the height of processed_data if no mask is provided.
ValueError – If a mask is provided, its length must match the height of processed_data, and the number of True values in the mask must match the number of rows in array.
- add_observer(event_name: str, callback: Callable)#
Register a callback function to be called when a property changes.
- apply_field_filters()#
Applies filters based on field values.
Field-based filters are stored in
self.filter_df. This method updatesself.filter_mask.
- auto_scale(sample_id, field, update=False)#
Auto-scales pixel values in map
Executes on
MainWindow.toolButtonAutoScaleclick.Outliers can make it difficult to view the variations of values within a map. This is a larger problem for linear scales, but can happen when log-scaled. Auto- scaling the data clips the values at a lower and upper bound. Auto-scaling may be acceptable as minerals that were not specifically calibrated can have erroneously high or low (even negative) values.
- Parameters:
update (bool) – Update auto scale parameters, by default, False
- clip_outliers(array, outlier_method, pl=None, pu=None, dpl=None, dpu=None)#
Attempts to remove outliers to by a method selected by the user.
- Parameters:
array (numpy.ndarray) – Data vector
outlier_method (str) – Method for removing outliers
pl (float, optional) – Lower percentile bound required by selected methods
pu (float, optional) – Upper percentile bound required by selected methods
dpl (float, optional) – Lower percentile bound for distances required by selected methods
dpu (float, optional) – Upper percentile bound for distances required by selected methods
- Returns:
Clipped data vector
- Return type:
- cluster_data()#
Clusters data for use with data preprocessing
_extended_summary_
- compute_ratio(analyte_1, analyte_2)#
Compute a ratio field from two analytes.
Ratios are computed on the processed_data, after negative handling, but before autoscaling.
- confirm_reset()#
A simple dialog that ensures the user wishes to reset data
- Returns:
Trueindicates user clickedYes,FalseforNo- Return type:
- create_label(column_name)#
Creates a default label for axes.
Creates a default label for axes on plots, using the column name in processed_data.
- Parameters:
column_name (str) – Column in processed_data.
- delete_column(column_name)#
Deletes a column and associated attributes from the AttributeDataFrame.
- Parameters:
column_name (str) – Name of column to remove.
- Raises:
ValueError – Raises an error if the column is not a member of the AttributeDataFrame.
- get_map_data(field, field_type='Analyte', norm=False, processed=True)#
Retrieves and processes the mapping data for the given sample and analytes
The method also updates certain parameters in the analyte data frame related to scaling. Based on the plot type, this method internally calls the appropriate plotting functions.
- Parameters:
field (str) – Name of field to plot. By default None.
field_type (str, optional) – Type of field to plot. Types include ‘Analyte’, ‘Ratio’, ‘PCA’, ‘Cluster’, ‘Cluster score’, ‘Special’, ‘Computed’. By default ‘Analyte’
norm (str) – Scale data as linear, log, etc. based on stored norm. If scale_data is False, the data are returned with a linear scale. By default False.
- Returns:
Processed data for plotting. This is only returned if analysis_type is not ‘laser’ or ‘hist’.
- Return type:
- get_processed_data()#
Gets the processed data for analysis
- Returns:
pandas.DataFrame – Filtered data frame
bool – Analytes included from processed data
- get_vector(field_type, field, norm='linear', processed=True)#
Creates a dictionary of values for plotting
- Returns:
Dictionary with array and additional relevant plot data, contains ‘field’, ‘type’, ‘label’, and ‘array’.
- Return type:
- k_optimal_clusters(data, max_clusters=10)#
Predicts the optimal number of clusters.
Predicts the optimal number of k-means clusters using the elbow method based on the within-cluster sum of squares (WCSS):
\[WCSS = \sum_{i=1}^k \sum_{x \in C_i} (x - \mu_i)^2\]The optimal number of clusters is determined by selecting the k-value corresponding to the maximum value of the second derivative of WCSS.
- Parameters:
data (numpy.ndarray) – Data used in clustering. Make sure it has NaN and ±inf values removed.
max_clusters (int, optional) – Computes cluster results from 1 to
max_clusters, by default 10.
- Returns:
The optimal number of k-means clusters.
- Return type:
- notify_observers(event_name: str, *args, **kwargs)#
Notify all registered observers of an event or property change.
- prep_data(field=None)#
Applies adjustments to data data prior to analyses and plotting.
This method applies a workflow to adjust data to limit the number of data that are otherwise unusable due to incorrect calibrations, particularly for low and high element concentration regions.
Data are adjusted according to the proceedure: | Determine optimal number of clusters and use it to classify the data using kmeans. | Transform each cluster, by handling negative data. The method of negative handling is set by
MainWindow.comboBoxNegativeMethod.currentText(). | Compute ratios not imported (i.e., not in raw_data). | Determine outliers and limit their impact on analyses by clipping/autoscalingThese calculations start from the cropped data, but do not include chemical, polygonal, or cluster filtering.
- Raises:
AssertionError – processed_data has not yet been initialized. processed_data should be created when the sample is initialized and prep_data is run for the first time.
- reset_crop()#
Reset the data to the original bounds.
Reseting the data to the original bounds results in deleting progress on analyses, computations, etc.
- reset_data()#
Reverts back to the original data.
What is reset?
What is not reset?
- reset_data_handling()#
Resets processed_data back to raw before performing autoscaling.
Any computed fields will be removed.
- reset_resolution()#
Resets dx and dy to initial values.
- scale_options(plot_type=None, ax=None, field_type=None, field=None)#
list : options for scaling the data.
- sort_data(method)#
Sorts analyte columns in the raw and processed data according to the specified method.
This method retrieves a list of analytes from the processed_data DataFrame and reorders the columns in both raw_data and processed_data based on the sorting strategy provided. The sorting is performed using an external function sort_analytes, which takes the user-defined method and the analyte list as inputs.
- Parameters:
method (str) – Sorting method selected by the user. This is passed to sort_analytes and determines the order in which analytes are arranged (e.g., alphabetical, PCA loadings, cluster association, etc.).
- Returns:
analyte_list (list) – the original list of analytes found in processed_data.
sorted_analyte_list (list) – the list of analytes sorted according to the provided method.
- swap_resolution()#
Swaps DX and DY for a dataframe, updates X and Y
Recalculates X and Y for a dataframe
- swap_xy()#
Swaps data in a SampleObj.
- transform_array(array, negative_method)#
Negative and zero handling with clustering for noise detection.
- Parameters:
array (numpy.ndarray) – Input data
negative_method (str) – Method for handling negative values
- Returns:
Transformed data
- Return type:
- update_norm(norm=None, field=None)#
Update the norm of the data.
- update_resolution(axis, value)#
Updates DX and DY for a dataframe
Recalculates X and Y for a dataframe when the user changes the value of pixel dimensions Dx or Dy
- class common.DataHandling.SampleObj(sample_id, file_path, outlier_method, negative_method, smoothing_method=None, ui=None)[source]#
Bases:
ObservableCreates a base sample object to store and manipulate geochemical data in map form
The sample object is initially constructed from the data within a *.lame.csv file and loaded into the
raw_datadataframe. The sample object also contains a number of properties in addition to the input data. These include metadata that are linked to each column. To make this link, the dataframe is initialized as anExtendedDF.AttributeDataFrame, which brings with it a number of methods to set, get and search the dataframe’s metadata.- Parameters:
sample_id (str) – Sample identifier.
file_path (str) – Path to data file for sample_id
outlier_method (str) – Method used ot handle outliers in the dataset
negative_method (str) – Method used to handle negative values in the dataset
ref_chem (pandas.DataFrame) – Reference chemistry for normalizing data
debug (bool, optional) – If true, will result in verbose output to stdout
- reset_data :
Reverts back to the original data
- add_columns :
Add one or more columns to the sample object
- delete_column :
Deletes a column and associated attributes from the AttributeDataFrame
- get_attribute_dict :
Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name
- swap_xy :
Swaps data in a SampleObj
- _swap_xy :
Swaps X and Y of a dataframe
- swap_resolution :
Swaps DX and DY for a dataframe
- reset_crop :
Reset the data to the new bounds.
- compute_ratio :
Compute a ratio field from two analytes
- cluster_data :
Clusters data for use with data preprocessing
- prep_data :
Applies adjustments to data data prior to analyses and plotting
- k_optimal_clusters :
Predicts the optimal number of clusters
- outlier_detection :
Outlier detection with cluster-based correction for negatives and compositional constraints, using percentile-based shifting
- transform_array :
Negative and zero handling with clustering for noise detection
- update_norm :
Update the norm of the data
- get_map_data :
Retrieves and processes the mapping data for the given sample and analytes
- get_processed_data :
Gets the processed data for analysis
- get_vector :
Creates a dictionary of values for plotting
- ref_chemdict
Reference chemistry. By default None.
- update_crop_mask#
Automatically update the crop_mask whenever crop bounds change.
- raw_data#
- filter_df#
- ‘field_type’ : (str) – field type‘field’ : (str) – name of field‘norm’ : (str) – scale normalization function,
linearorlog‘min’ : (float) – minimum value for filtering‘max’ : (float) – maximum value for filtering‘operator’ : (str) – boolean operator for combining filters,andoror‘use’ : (bool) –Trueindicates the filter should be used to filter data‘persistent’ : (bool) –Trueretains the filter when the sample is changed‘crop’ : () –‘x_max’ : () –‘x_min’ : () –‘y_max’ : () –‘y_min’ : () –‘crop_x_max’ : () –‘crop_x_min’ : () –‘crop_y_max’ : () –‘crop_y_min’ : () –‘processed data’: () –‘raw_data’: () –‘cropped_raw_data’: () –‘crop’ : () –‘x_max’ : () –‘x_min’ : () –‘y_max’ : () –‘y_min’ : () –‘crop_x_max’ : () –‘crop_x_min’ : () –‘crop_y_max’ : () –‘crop_y_min’ : () –‘raw_data’: () –‘cropped_raw_data’: () –‘raw data’ : (pandas.DataFrame) –‘x_min’ : (float) – minimum x of full data‘x_max’ : (float) – maximum x of full data‘y_min’ : (float) – minimum y of full data‘y_max’ : (float) – maximum y of full data‘crop_x_min’ : (float) – minimum x of cropped data‘crop_x_max’ : (float) – maximum x of cropped data‘crop_x_min’ : (float) – minimum y of cropped data‘crop_x_max’ : (float) – maximum y of cropped data‘norm’ : () –‘analysis data’ : (pandas.DataFrame) –‘cropped_raw_data’ : (pandas.DataFrame) –- Type:
(pandas.DataFrame) – stores filters for each sample
- 'processed_data'
- Type:
(pandas.DataFrame) –
- 'crop_mask'
- Type:
(MaskObj) – mask created from cropped axes.
- 'filter_mask'
- Type:
(MaskObj) – mask created by a combination of filters. Filters are displayed for the user in
tableWidgetFilters.
- 'polygon_mask'
- Type:
(MaskObj) – mask created from selected polygons.
- 'cluster_mask'
- Type:
(MaskObj) – mask created from selected or inverse selected cluster groups. Once this mask is set, it cannot be reset unless it is turned off, clustering is recomputed, and selected clusters are used to produce a new mask.
- 'mask'
- Type:
() – combined mask, derived from filter_mask & ‘polygon_mask’ & ‘crop_mask’
- Attributes:
apply_outlier_to_allbool : flag that indicates whether the outlier method should be applied to all analytes.
array_sizetuple : (int, int) Size of map in pixels
aspect_ratiofloat : Aspect ratio of maps (dy / dx).
- auto_scale_value
crop_masknumpy.ndarray: Boolean mask used to crop the raw data. True values will be used.
current_fieldstr :
data_max_diff_quantilefloat : maximum quantile for differences used for autoscaling.
data_max_quantilefloat : maximum quantile used for autoscaling.
data_min_diff_quantilefloat : minimum quantile for differences used for autoscaling.
data_min_quantilefloat : minimum quantile used for autoscaling.
dxfloat : Width of pixels in x-direction.
dyfloat : Width of pixels in y-direction.
negative_methodstr : Method for negative handling.
- nx
- ny
outlier_methodstr : Method for predicting and clipping outliers.
valid_data_typeslist : data types possible for in processed_data.
xnumpy.ndarray : Value of x-coordinate associated with map data
x_rangefloat : Range of pixels in x-direction.
xlimlist : (float, float) Limits of pixels in x-direction.
ynumpy.ndarray : Value of y-coordinate associated with map data
y_rangefloat : Range of pixels in y-direction.
ylimlist : (float, float) Limits of pixels in y-direction.
Methods
add_columns(data_type, column_names, array)Add one or more columns to the sample object.
add_observer(event_name, callback)Register a callback function to be called when a property changes.
Applies filters based on field values.
auto_scale(sample_id, field[, update])Auto-scales pixel values in map
clip_outliers(array, outlier_method[, pl, ...])Attempts to remove outliers to by a method selected by the user.
Clusters data for use with data preprocessing
compute_ratio(analyte_1, analyte_2)Compute a ratio field from two analytes.
A simple dialog that ensures the user wishes to reset data
create_label(column_name)Creates a default label for axes.
delete_column(column_name)Deletes a column and associated attributes from the AttributeDataFrame.
get_map_data(field[, field_type, norm, ...])Retrieves and processes the mapping data for the given sample and analytes
Gets the processed data for analysis
get_vector(field_type, field[, norm, processed])Creates a dictionary of values for plotting
k_optimal_clusters(data[, max_clusters])Predicts the optimal number of clusters.
notify_observers(event_name, *args, **kwargs)Notify all registered observers of an event or property change.
prep_data([field])Applies adjustments to data data prior to analyses and plotting.
remove_observer(event_name, callback)Deregister a callback function from an event.
Reset the data to the original bounds.
Reverts back to the original data.
Resets processed_data back to raw before performing autoscaling.
Resets dx and dy to initial values.
scale_options([plot_type, ax, field_type, field])list : options for scaling the data.
sort_data(method)Sorts analyte columns in the raw and processed data according to the specified method.
Swaps DX and DY for a dataframe, updates X and Y
swap_xy()Swaps data in a SampleObj.
transform_array(array, negative_method)Negative and zero handling with clustering for noise detection.
update_norm([norm, field])Update the norm of the data.
update_resolution(axis, value)Updates DX and DY for a dataframe
- add_columns(data_type, column_names, array, mask=None)[source]#
Add one or more columns to the sample object.
Adds one or more columns to SampleObj.processed_data. If a mask is provided, the data is placed in the correct rows based on the mask.
- Parameters:
data_type (str) – The type of data stored in the columns.
column_names (str or list of str) – The name or names of the columns to add. If a column already exists, it will be overwritten.
array (numpy.ndarray) – A 1D array (for single column) or 2D array (for multiple columns). The data to be added.
mask (numpy.ndarray, optional) – A boolean mask that indicates which rows in the original data should be filled. If not provided, the length of array must match the height of processed_data.
- Returns:
Returns a message if a column is overwritten, or a dictionary with column names as keys and “overwritten” or “added” as values if multiple columns are added.
- Return type:
- Raises:
ValueError – Valid types are given in SampleObj._valid_data_types.
ValueError – The number of columns in the array must match the length of column_names (if multiple columns are being added).
ValueError – The length of array must match the height of processed_data if no mask is provided.
ValueError – If a mask is provided, its length must match the height of processed_data, and the number of True values in the mask must match the number of rows in array.
- add_observer(event_name: str, callback: Callable)#
Register a callback function to be called when a property changes.
- apply_field_filters()[source]#
Applies filters based on field values.
Field-based filters are stored in
self.filter_df. This method updatesself.filter_mask.
- property apply_outlier_to_all#
flag that indicates whether the outlier method should be applied to all analytes.
- Type:
- auto_scale(sample_id, field, update=False)[source]#
Auto-scales pixel values in map
Executes on
MainWindow.toolButtonAutoScaleclick.Outliers can make it difficult to view the variations of values within a map. This is a larger problem for linear scales, but can happen when log-scaled. Auto- scaling the data clips the values at a lower and upper bound. Auto-scaling may be acceptable as minerals that were not specifically calibrated can have erroneously high or low (even negative) values.
- Parameters:
update (bool) – Update auto scale parameters, by default, False
- property auto_scale_value#
- clip_outliers(array, outlier_method, pl=None, pu=None, dpl=None, dpu=None)[source]#
Attempts to remove outliers to by a method selected by the user.
- Parameters:
array (numpy.ndarray) – Data vector
outlier_method (str) – Method for removing outliers
pl (float, optional) – Lower percentile bound required by selected methods
pu (float, optional) – Upper percentile bound required by selected methods
dpl (float, optional) – Lower percentile bound for distances required by selected methods
dpu (float, optional) – Upper percentile bound for distances required by selected methods
- Returns:
Clipped data vector
- Return type:
- compute_ratio(analyte_1, analyte_2)[source]#
Compute a ratio field from two analytes.
Ratios are computed on the processed_data, after negative handling, but before autoscaling.
- confirm_reset()[source]#
A simple dialog that ensures the user wishes to reset data
- Returns:
Trueindicates user clickedYes,FalseforNo- Return type:
- create_label(column_name)[source]#
Creates a default label for axes.
Creates a default label for axes on plots, using the column name in processed_data.
- Parameters:
column_name (str) – Column in processed_data.
- property crop_mask#
Boolean mask used to crop the raw data. True values will be used.
- Type:
- property current_field#
str:
- delete_column(column_name)[source]#
Deletes a column and associated attributes from the AttributeDataFrame.
- Parameters:
column_name (str) – Name of column to remove.
- Raises:
ValueError – Raises an error if the column is not a member of the AttributeDataFrame.
- get_map_data(field, field_type='Analyte', norm=False, processed=True)[source]#
Retrieves and processes the mapping data for the given sample and analytes
The method also updates certain parameters in the analyte data frame related to scaling. Based on the plot type, this method internally calls the appropriate plotting functions.
- Parameters:
field (str) – Name of field to plot. By default None.
field_type (str, optional) – Type of field to plot. Types include ‘Analyte’, ‘Ratio’, ‘PCA’, ‘Cluster’, ‘Cluster score’, ‘Special’, ‘Computed’. By default ‘Analyte’
norm (str) – Scale data as linear, log, etc. based on stored norm. If scale_data is False, the data are returned with a linear scale. By default False.
- Returns:
Processed data for plotting. This is only returned if analysis_type is not ‘laser’ or ‘hist’.
- Return type:
- get_processed_data()[source]#
Gets the processed data for analysis
- Returns:
pandas.DataFrame – Filtered data frame
bool – Analytes included from processed data
- get_vector(field_type, field, norm='linear', processed=True)[source]#
Creates a dictionary of values for plotting
- Returns:
Dictionary with array and additional relevant plot data, contains ‘field’, ‘type’, ‘label’, and ‘array’.
- Return type:
- k_optimal_clusters(data, max_clusters=10)[source]#
Predicts the optimal number of clusters.
Predicts the optimal number of k-means clusters using the elbow method based on the within-cluster sum of squares (WCSS):
\[WCSS = \sum_{i=1}^k \sum_{x \in C_i} (x - \mu_i)^2\]The optimal number of clusters is determined by selecting the k-value corresponding to the maximum value of the second derivative of WCSS.
- Parameters:
data (numpy.ndarray) – Data used in clustering. Make sure it has NaN and ±inf values removed.
max_clusters (int, optional) – Computes cluster results from 1 to
max_clusters, by default 10.
- Returns:
The optimal number of k-means clusters.
- Return type:
- notify_observers(event_name: str, *args, **kwargs)#
Notify all registered observers of an event or property change.
- property nx#
- property ny#
- prep_data(field=None)[source]#
Applies adjustments to data data prior to analyses and plotting.
This method applies a workflow to adjust data to limit the number of data that are otherwise unusable due to incorrect calibrations, particularly for low and high element concentration regions.
Data are adjusted according to the proceedure: | Determine optimal number of clusters and use it to classify the data using kmeans. | Transform each cluster, by handling negative data. The method of negative handling is set by
MainWindow.comboBoxNegativeMethod.currentText(). | Compute ratios not imported (i.e., not in raw_data). | Determine outliers and limit their impact on analyses by clipping/autoscalingThese calculations start from the cropped data, but do not include chemical, polygonal, or cluster filtering.
- Raises:
AssertionError – processed_data has not yet been initialized. processed_data should be created when the sample is initialized and prep_data is run for the first time.
- reset_crop()[source]#
Reset the data to the original bounds.
Reseting the data to the original bounds results in deleting progress on analyses, computations, etc.
- reset_data_handling()[source]#
Resets processed_data back to raw before performing autoscaling.
Any computed fields will be removed.
- scale_options(plot_type=None, ax=None, field_type=None, field=None)[source]#
list : options for scaling the data.
- sort_data(method)[source]#
Sorts analyte columns in the raw and processed data according to the specified method.
This method retrieves a list of analytes from the processed_data DataFrame and reorders the columns in both raw_data and processed_data based on the sorting strategy provided. The sorting is performed using an external function sort_analytes, which takes the user-defined method and the analyte list as inputs.
- Parameters:
method (str) – Sorting method selected by the user. This is passed to sort_analytes and determines the order in which analytes are arranged (e.g., alphabetical, PCA loadings, cluster association, etc.).
- Returns:
analyte_list (list) – the original list of analytes found in processed_data.
sorted_analyte_list (list) – the list of analytes sorted according to the provided method.
- swap_resolution()[source]#
Swaps DX and DY for a dataframe, updates X and Y
Recalculates X and Y for a dataframe
- transform_array(array, negative_method)[source]#
Negative and zero handling with clustering for noise detection.
- Parameters:
array (numpy.ndarray) – Input data
negative_method (str) – Method for handling negative values
- Returns:
Transformed data
- Return type:
- update_resolution(axis, value)[source]#
Updates DX and DY for a dataframe
Recalculates X and Y for a dataframe when the user changes the value of pixel dimensions Dx or Dy
- property x#
Value of x-coordinate associated with map data
- Type:
- property y#
Value of y-coordinate associated with map data
- Type:
- class common.DataHandling.XRFSampleObj(sample_id, file_path, outlier_method, negative_method, smoothing_method=None, ui=None)[source]#
Bases:
SampleObj- Attributes:
apply_outlier_to_allbool : flag that indicates whether the outlier method should be applied to all analytes.
array_sizetuple : (int, int) Size of map in pixels
aspect_ratiofloat : Aspect ratio of maps (dy / dx).
- auto_scale_value
crop_masknumpy.ndarray: Boolean mask used to crop the raw data. True values will be used.
current_fieldstr :
data_max_diff_quantilefloat : maximum quantile for differences used for autoscaling.
data_max_quantilefloat : maximum quantile used for autoscaling.
data_min_diff_quantilefloat : minimum quantile for differences used for autoscaling.
data_min_quantilefloat : minimum quantile used for autoscaling.
dxfloat : Width of pixels in x-direction.
dyfloat : Width of pixels in y-direction.
negative_methodstr : Method for negative handling.
- nx
- ny
outlier_methodstr : Method for predicting and clipping outliers.
valid_data_typeslist : data types possible for in processed_data.
xnumpy.ndarray : Value of x-coordinate associated with map data
x_rangefloat : Range of pixels in x-direction.
xlimlist : (float, float) Limits of pixels in x-direction.
ynumpy.ndarray : Value of y-coordinate associated with map data
y_rangefloat : Range of pixels in y-direction.
ylimlist : (float, float) Limits of pixels in y-direction.
Methods
add_columns(data_type, column_names, array)Add one or more columns to the sample object.
add_observer(event_name, callback)Register a callback function to be called when a property changes.
Applies filters based on field values.
auto_scale(sample_id, field[, update])Auto-scales pixel values in map
clip_outliers(array, outlier_method[, pl, ...])Attempts to remove outliers to by a method selected by the user.
Clusters data for use with data preprocessing
compute_ratio(analyte_1, analyte_2)Compute a ratio field from two analytes.
A simple dialog that ensures the user wishes to reset data
create_label(column_name)Creates a default label for axes.
delete_column(column_name)Deletes a column and associated attributes from the AttributeDataFrame.
get_map_data(field[, field_type, norm, ...])Retrieves and processes the mapping data for the given sample and analytes
Gets the processed data for analysis
get_vector(field_type, field[, norm, processed])Creates a dictionary of values for plotting
k_optimal_clusters(data[, max_clusters])Predicts the optimal number of clusters.
notify_observers(event_name, *args, **kwargs)Notify all registered observers of an event or property change.
prep_data([field])Applies adjustments to data data prior to analyses and plotting.
remove_observer(event_name, callback)Deregister a callback function from an event.
Reset the data to the original bounds.
Reverts back to the original data.
Resets processed_data back to raw before performing autoscaling.
Resets dx and dy to initial values.
scale_options([plot_type, ax, field_type, field])list : options for scaling the data.
sort_data(method)Sorts analyte columns in the raw and processed data according to the specified method.
Swaps DX and DY for a dataframe, updates X and Y
swap_xy()Swaps data in a SampleObj.
transform_array(array, negative_method)Negative and zero handling with clustering for noise detection.
update_norm([norm, field])Update the norm of the data.
update_resolution(axis, value)Updates DX and DY for a dataframe
- add_columns(data_type, column_names, array, mask=None)#
Add one or more columns to the sample object.
Adds one or more columns to SampleObj.processed_data. If a mask is provided, the data is placed in the correct rows based on the mask.
- Parameters:
data_type (str) – The type of data stored in the columns.
column_names (str or list of str) – The name or names of the columns to add. If a column already exists, it will be overwritten.
array (numpy.ndarray) – A 1D array (for single column) or 2D array (for multiple columns). The data to be added.
mask (numpy.ndarray, optional) – A boolean mask that indicates which rows in the original data should be filled. If not provided, the length of array must match the height of processed_data.
- Returns:
Returns a message if a column is overwritten, or a dictionary with column names as keys and “overwritten” or “added” as values if multiple columns are added.
- Return type:
- Raises:
ValueError – Valid types are given in SampleObj._valid_data_types.
ValueError – The number of columns in the array must match the length of column_names (if multiple columns are being added).
ValueError – The length of array must match the height of processed_data if no mask is provided.
ValueError – If a mask is provided, its length must match the height of processed_data, and the number of True values in the mask must match the number of rows in array.
- add_observer(event_name: str, callback: Callable)#
Register a callback function to be called when a property changes.
- apply_field_filters()#
Applies filters based on field values.
Field-based filters are stored in
self.filter_df. This method updatesself.filter_mask.
- auto_scale(sample_id, field, update=False)#
Auto-scales pixel values in map
Executes on
MainWindow.toolButtonAutoScaleclick.Outliers can make it difficult to view the variations of values within a map. This is a larger problem for linear scales, but can happen when log-scaled. Auto- scaling the data clips the values at a lower and upper bound. Auto-scaling may be acceptable as minerals that were not specifically calibrated can have erroneously high or low (even negative) values.
- Parameters:
update (bool) – Update auto scale parameters, by default, False
- clip_outliers(array, outlier_method, pl=None, pu=None, dpl=None, dpu=None)#
Attempts to remove outliers to by a method selected by the user.
- Parameters:
array (numpy.ndarray) – Data vector
outlier_method (str) – Method for removing outliers
pl (float, optional) – Lower percentile bound required by selected methods
pu (float, optional) – Upper percentile bound required by selected methods
dpl (float, optional) – Lower percentile bound for distances required by selected methods
dpu (float, optional) – Upper percentile bound for distances required by selected methods
- Returns:
Clipped data vector
- Return type:
- cluster_data()#
Clusters data for use with data preprocessing
_extended_summary_
- compute_ratio(analyte_1, analyte_2)#
Compute a ratio field from two analytes.
Ratios are computed on the processed_data, after negative handling, but before autoscaling.
- confirm_reset()#
A simple dialog that ensures the user wishes to reset data
- Returns:
Trueindicates user clickedYes,FalseforNo- Return type:
- create_label(column_name)#
Creates a default label for axes.
Creates a default label for axes on plots, using the column name in processed_data.
- Parameters:
column_name (str) – Column in processed_data.
- delete_column(column_name)#
Deletes a column and associated attributes from the AttributeDataFrame.
- Parameters:
column_name (str) – Name of column to remove.
- Raises:
ValueError – Raises an error if the column is not a member of the AttributeDataFrame.
- get_map_data(field, field_type='Analyte', norm=False, processed=True)#
Retrieves and processes the mapping data for the given sample and analytes
The method also updates certain parameters in the analyte data frame related to scaling. Based on the plot type, this method internally calls the appropriate plotting functions.
- Parameters:
field (str) – Name of field to plot. By default None.
field_type (str, optional) – Type of field to plot. Types include ‘Analyte’, ‘Ratio’, ‘PCA’, ‘Cluster’, ‘Cluster score’, ‘Special’, ‘Computed’. By default ‘Analyte’
norm (str) – Scale data as linear, log, etc. based on stored norm. If scale_data is False, the data are returned with a linear scale. By default False.
- Returns:
Processed data for plotting. This is only returned if analysis_type is not ‘laser’ or ‘hist’.
- Return type:
- get_processed_data()#
Gets the processed data for analysis
- Returns:
pandas.DataFrame – Filtered data frame
bool – Analytes included from processed data
- get_vector(field_type, field, norm='linear', processed=True)#
Creates a dictionary of values for plotting
- Returns:
Dictionary with array and additional relevant plot data, contains ‘field’, ‘type’, ‘label’, and ‘array’.
- Return type:
- k_optimal_clusters(data, max_clusters=10)#
Predicts the optimal number of clusters.
Predicts the optimal number of k-means clusters using the elbow method based on the within-cluster sum of squares (WCSS):
\[WCSS = \sum_{i=1}^k \sum_{x \in C_i} (x - \mu_i)^2\]The optimal number of clusters is determined by selecting the k-value corresponding to the maximum value of the second derivative of WCSS.
- Parameters:
data (numpy.ndarray) – Data used in clustering. Make sure it has NaN and ±inf values removed.
max_clusters (int, optional) – Computes cluster results from 1 to
max_clusters, by default 10.
- Returns:
The optimal number of k-means clusters.
- Return type:
- notify_observers(event_name: str, *args, **kwargs)#
Notify all registered observers of an event or property change.
- prep_data(field=None)#
Applies adjustments to data data prior to analyses and plotting.
This method applies a workflow to adjust data to limit the number of data that are otherwise unusable due to incorrect calibrations, particularly for low and high element concentration regions.
Data are adjusted according to the proceedure: | Determine optimal number of clusters and use it to classify the data using kmeans. | Transform each cluster, by handling negative data. The method of negative handling is set by
MainWindow.comboBoxNegativeMethod.currentText(). | Compute ratios not imported (i.e., not in raw_data). | Determine outliers and limit their impact on analyses by clipping/autoscalingThese calculations start from the cropped data, but do not include chemical, polygonal, or cluster filtering.
- Raises:
AssertionError – processed_data has not yet been initialized. processed_data should be created when the sample is initialized and prep_data is run for the first time.
- reset_crop()#
Reset the data to the original bounds.
Reseting the data to the original bounds results in deleting progress on analyses, computations, etc.
- reset_data()#
Reverts back to the original data.
What is reset?
What is not reset?
- reset_data_handling()#
Resets processed_data back to raw before performing autoscaling.
Any computed fields will be removed.
- reset_resolution()#
Resets dx and dy to initial values.
- scale_options(plot_type=None, ax=None, field_type=None, field=None)#
list : options for scaling the data.
- sort_data(method)#
Sorts analyte columns in the raw and processed data according to the specified method.
This method retrieves a list of analytes from the processed_data DataFrame and reorders the columns in both raw_data and processed_data based on the sorting strategy provided. The sorting is performed using an external function sort_analytes, which takes the user-defined method and the analyte list as inputs.
- Parameters:
method (str) – Sorting method selected by the user. This is passed to sort_analytes and determines the order in which analytes are arranged (e.g., alphabetical, PCA loadings, cluster association, etc.).
- Returns:
analyte_list (list) – the original list of analytes found in processed_data.
sorted_analyte_list (list) – the list of analytes sorted according to the provided method.
- swap_resolution()#
Swaps DX and DY for a dataframe, updates X and Y
Recalculates X and Y for a dataframe
- swap_xy()#
Swaps data in a SampleObj.
- transform_array(array, negative_method)#
Negative and zero handling with clustering for noise detection.
- Parameters:
array (numpy.ndarray) – Input data
negative_method (str) – Method for handling negative values
- Returns:
Transformed data
- Return type:
- update_norm(norm=None, field=None)#
Update the norm of the data.
- update_resolution(axis, value)#
Updates DX and DY for a dataframe
Recalculates X and Y for a dataframe when the user changes the value of pixel dimensions Dx or Dy
common.ExtendedDF module#
- class common.ExtendedDF.AttributeDataFrame(data=None, *args, **kwargs)[source]#
Bases:
DataFrameCreates a pandas DataFrame with custom attributes stored with each column.
Create a dataframe with column attributes or add attributes to existing columns of a dataframe and methods to get and set them.
- Parameters:
data (pandas.DataFrame) – Input dataframe, if none provided an empty dataframe can be created, defaults to
None
- attributes_to_dataframe :
Return selected attributes of all columns in the AttributeDataFrame as a new DataFrame
- copy_columns :
Extract specified columns into a new AttributeDataFrame, preserving their attributes
- match_attribute :
Returns a list of columns where a specific attribute matches the given value
- match_attributes :
Returns a list of columns where each attribute matches its corresponding value.
- get_attribute :
Get an attribute from an AttributeDataFrame given a column or set of columns
- get_attribute_dict :
Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name.
- is_attribute :
Checks to see if an attribute exists
- set_attribute :
Set one or more values for columns of an attribute in an AttributeDataFrame
- _set_attribute :
Set a single attribute in a column of an AttributeDataFrame
- show_attributes :
Prints the attributes stored in the dataframe
- sort_columns :
Sorts columns and attributes of an AttributeDataFrame object.
- Returns:
Adds a dictionary
column_attributesto a dataframe and the methods to add, set, and get column attributes and their values.- Return type:
Examples
Example 1: Creating the DataFrame with no initial data df = AttributeDataFrame() print(df) # Output: Empty DataFrame
# Adding data and attributes df[‘Temperature’] = [22, 23, 21] df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Temperature’, ‘average’, 22) df.set_attribute(‘Temperature’, ‘uncertainty’, 1)
print(df) print(df.get_attribute(‘Temperature’, ‘units’)) # Output: Celsius print(df.get_attribute(‘Temperature’, ‘average’)) # Output: 22 print(df.get_attribute(‘Temperature’, ‘uncertainty’)) # Output: 1
Example 2: Creating the DataFrame from an existing dataframe
#df = AttributeDataFrame(data, column_attributes=column_attributes)
# Accessing attributes using methods #print(df.get_attribute(‘Temperature’, ‘units’)) # Output: Celsius #print(df.get_attribute(‘Pressure’, ‘average’)) # Output: 101
# Setting new attributes #df.set_attribute(‘Temperature’, ‘range’, (20, 25)) #print(df.get_attribute(‘Temperature’, ‘range’)) # Output: (20, 25)
- Attributes:
TThe transpose of the DataFrame.
atAccess a single value for a row/column label pair.
attrsDictionary of global attributes of this dataset.
axesReturn a list representing the axes of the DataFrame.
- columns
The column labels of the DataFrame.
>>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]}) >>> df A B 0 1 3 1 2 4 >>> df.columns Index(['A', 'B'], dtype='object')
dtypesReturn the dtypes in the DataFrame.
emptyIndicator whether Series/DataFrame is empty.
flagsGet the properties associated with this pandas object.
iatAccess a single value for a row/column pair by integer position.
ilocPurely integer-location based indexing for selection by position.
- index
The index (row labels) of the DataFrame.
The index of a DataFrame is a series of labels that identify each row. The labels can be integers, strings, or any other hashable type. The index is used for label-based access and alignment, and can be accessed or modified using this attribute.
- pandas.Index
The index labels of the DataFrame.
DataFrame.columns : The column labels of the DataFrame. DataFrame.to_numpy : Convert the DataFrame to a NumPy array.
>>> df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Aritra'], ... 'Age': [25, 30, 35], ... 'Location': ['Seattle', 'New York', 'Kona']}, ... index=([10, 20, 30])) >>> df.index Index([10, 20, 30], dtype='int64')
In this example, we create a DataFrame with 3 rows and 3 columns, including Name, Age, and Location information. We set the index labels to be the integers 10, 20, and 30. We then access the index attribute of the DataFrame, which returns an Index object containing the index labels.
>>> df.index = [100, 200, 300] >>> df Name Age Location 100 Alice 25 Seattle 200 Bob 30 New York 300 Aritra 35 Kona
In this example, we modify the index labels of the DataFrame by assigning a new list of labels to the index attribute. The DataFrame is then updated with the new labels, and the output shows the modified DataFrame.
locAccess a group of rows and columns by label(s) or a boolean array.
ndimReturn an int representing the number of axes / array dimensions.
shapeReturn a tuple representing the dimensionality of the DataFrame.
sizeReturn an int representing the number of elements in this object.
styleReturns a Styler object.
valuesReturn a Numpy representation of the DataFrame.
Methods
abs()Return a Series/DataFrame with absolute numeric value of each element.
add(other[, axis, level, fill_value])Get Addition of dataframe and other, element-wise (binary operator add).
add_prefix(prefix[, axis])Prefix labels with string prefix.
add_suffix(suffix[, axis])Suffix labels with string suffix.
agg([func, axis])Aggregate using one or more operations over the specified axis.
aggregate([func, axis])Aggregate using one or more operations over the specified axis.
align(other[, join, axis, level, copy, ...])Align two objects on their axes with the specified join method.
all([axis, bool_only, skipna])Return whether all elements are True, potentially over an axis.
any(*[, axis, bool_only, skipna])Return whether any element is True, potentially over an axis.
apply(func[, axis, raw, result_type, args, ...])Apply a function along an axis of the DataFrame.
applymap(func[, na_action])Apply a function to a Dataframe elementwise.
asfreq(freq[, method, how, normalize, ...])Convert time series to specified frequency.
asof(where[, subset])Return the last row(s) without any NaNs before where.
assign(**kwargs)Assign new columns to a DataFrame.
astype(dtype[, copy, errors])Cast a pandas object to a specified dtype
dtype.at_time(time[, asof, axis])Select values at particular time of day (e.g., 9:30AM).
attributes_to_dataframe([attributes])Return selected attributes of all columns in the AttributeDataFrame as a new DataFrame.
backfill(*[, axis, inplace, limit, downcast])Fill NA/NaN values by using the next valid observation to fill the gap.
between_time(start_time, end_time[, ...])Select values between particular times of the day (e.g., 9:00-9:30 AM).
bfill(*[, axis, inplace, limit, limit_area, ...])Fill NA/NaN values by using the next valid observation to fill the gap.
bool()Return the bool of a single element Series or DataFrame.
boxplot([column, by, ax, fontsize, rot, ...])Make a box plot from DataFrame columns.
clip([lower, upper, axis, inplace])Trim values at input threshold(s).
combine(other, func[, fill_value, overwrite])Perform column-wise combine with another DataFrame.
combine_first(other)Update null elements with value in the same location in other.
compare(other[, align_axis, keep_shape, ...])Compare to another DataFrame and show the differences.
convert_dtypes([infer_objects, ...])Convert columns to the best possible dtypes using dtypes supporting
pd.NA.copy([deep])Make a copy of this object's indices and data.
copy_columns([columns])Extract specified columns into a new AttributeDataFrame, preserving their attributes.
corr([method, min_periods, numeric_only])Compute pairwise correlation of columns, excluding NA/null values.
corrwith(other[, axis, drop, method, ...])Compute pairwise correlation.
count([axis, numeric_only])Count non-NA cells for each column or row.
cov([min_periods, ddof, numeric_only])Compute pairwise covariance of columns, excluding NA/null values.
cummax([axis, skipna])Return cumulative maximum over a DataFrame or Series axis.
cummin([axis, skipna])Return cumulative minimum over a DataFrame or Series axis.
cumprod([axis, skipna])Return cumulative product over a DataFrame or Series axis.
cumsum([axis, skipna])Return cumulative sum over a DataFrame or Series axis.
describe([percentiles, include, exclude])Generate descriptive statistics.
diff([periods, axis])First discrete difference of element.
div(other[, axis, level, fill_value])Get Floating division of dataframe and other, element-wise (binary operator truediv).
divide(other[, axis, level, fill_value])Get Floating division of dataframe and other, element-wise (binary operator truediv).
dot(other)Compute the matrix multiplication between the DataFrame and other.
drop([labels, axis, index, columns, level, ...])Drop specified labels from rows or columns.
drop_duplicates([subset, keep, inplace, ...])Return DataFrame with duplicate rows removed.
droplevel(level[, axis])Return Series/DataFrame with requested index / column level(s) removed.
dropna(*[, axis, how, thresh, subset, ...])Remove missing values.
duplicated([subset, keep])Return boolean Series denoting duplicate rows.
eq(other[, axis, level])Get Equal to of dataframe and other, element-wise (binary operator eq).
equals(other)Test whether two objects contain the same elements.
eval(expr, *[, inplace])Evaluate a string describing operations on DataFrame columns.
ewm([com, span, halflife, alpha, ...])Provide exponentially weighted (EW) calculations.
expanding([min_periods, axis, method])Provide expanding window calculations.
explode(column[, ignore_index])Transform each element of a list-like to a row, replicating index values.
ffill(*[, axis, inplace, limit, limit_area, ...])Fill NA/NaN values by propagating the last valid observation to next valid.
fillna([value, method, axis, inplace, ...])Fill NA/NaN values using the specified method.
filter([items, like, regex, axis])Subset the dataframe rows or columns according to the specified index labels.
first(offset)Select initial periods of time series data based on a date offset.
first_valid_index()Return index for first non-NA value or None, if no non-NA value is found.
floordiv(other[, axis, level, fill_value])Get Integer division of dataframe and other, element-wise (binary operator floordiv).
from_dict(data[, orient, dtype, columns])Construct DataFrame from dict of array-like or dicts.
from_records(data[, index, exclude, ...])Convert structured or record ndarray to DataFrame.
ge(other[, axis, level])Get Greater than or equal to of dataframe and other, element-wise (binary operator ge).
get(key[, default])Get item from object for given key (ex: DataFrame column).
get_attribute(columns, attribute)Get a single attribute from an AttributeDataFrame for one or more columns.
get_attribute_dict(attribute_name)Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name.
groupby([by, axis, level, as_index, sort, ...])Group DataFrame using a mapper or by a Series of columns.
gt(other[, axis, level])Get Greater than of dataframe and other, element-wise (binary operator gt).
head([n])Return the first n rows.
hist([column, by, grid, xlabelsize, xrot, ...])Make a histogram of the DataFrame's columns.
idxmax([axis, skipna, numeric_only])Return index of first occurrence of maximum over requested axis.
idxmin([axis, skipna, numeric_only])Return index of first occurrence of minimum over requested axis.
infer_objects([copy])Attempt to infer better dtypes for object columns.
info([verbose, buf, max_cols, memory_usage, ...])Print a concise summary of a DataFrame.
insert(loc, column, value[, allow_duplicates])Insert column into DataFrame at specified location.
interpolate([method, axis, limit, inplace, ...])Fill NaN values using an interpolation method.
is_attribute(column, attribute)Check if a given attribute exists for the specified column.
isetitem(loc, value)Set the given value in the column with position loc.
isin(values)Whether each element in the DataFrame is contained in values.
isna()Detect missing values.
isnull()DataFrame.isnull is an alias for DataFrame.isna.
items()Iterate over (column name, Series) pairs.
iterrows()Iterate over DataFrame rows as (index, Series) pairs.
itertuples([index, name])Iterate over DataFrame rows as namedtuples.
join(other[, on, how, lsuffix, rsuffix, ...])Join columns of another DataFrame.
keys()Get the 'info axis' (see Indexing for more).
kurt([axis, skipna, numeric_only])Return unbiased kurtosis over requested axis.
kurtosis([axis, skipna, numeric_only])Return unbiased kurtosis over requested axis.
last(offset)Select final periods of time series data based on a date offset.
last_valid_index()Return index for last non-NA value or None, if no non-NA value is found.
le(other[, axis, level])Get Less than or equal to of dataframe and other, element-wise (binary operator le).
lt(other[, axis, level])Get Less than of dataframe and other, element-wise (binary operator lt).
map(func[, na_action])Apply a function to a Dataframe elementwise.
mask(cond[, other, inplace, axis, level])Replace values where the condition is True.
match_attribute(attribute, value)Returns a list of columns where a specific attribute matches the given value.
match_attributes(attributes_dict)Returns a list of columns where each attribute matches its corresponding value.
max([axis, skipna, numeric_only])Return the maximum of the values over the requested axis.
mean([axis, skipna, numeric_only])Return the mean of the values over the requested axis.
median([axis, skipna, numeric_only])Return the median of the values over the requested axis.
melt([id_vars, value_vars, var_name, ...])Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
memory_usage([index, deep])Return the memory usage of each column in bytes.
merge(right[, how, on, left_on, right_on, ...])Merge DataFrame or named Series objects with a database-style join.
min([axis, skipna, numeric_only])Return the minimum of the values over the requested axis.
mod(other[, axis, level, fill_value])Get Modulo of dataframe and other, element-wise (binary operator mod).
mode([axis, numeric_only, dropna])Get the mode(s) of each element along the selected axis.
mul(other[, axis, level, fill_value])Get Multiplication of dataframe and other, element-wise (binary operator mul).
multiply(other[, axis, level, fill_value])Get Multiplication of dataframe and other, element-wise (binary operator mul).
ne(other[, axis, level])Get Not equal to of dataframe and other, element-wise (binary operator ne).
nlargest(n, columns[, keep])Return the first n rows ordered by columns in descending order.
notna()Detect existing (non-missing) values.
notnull()DataFrame.notnull is an alias for DataFrame.notna.
nsmallest(n, columns[, keep])Return the first n rows ordered by columns in ascending order.
nunique([axis, dropna])Count number of distinct elements in specified axis.
pad(*[, axis, inplace, limit, downcast])Fill NA/NaN values by propagating the last valid observation to next valid.
pct_change([periods, fill_method, limit, freq])Fractional change between the current and a prior element.
pipe(func, *args, **kwargs)Apply chainable functions that expect Series or DataFrames.
pivot(*, columns[, index, values])Return reshaped DataFrame organized by given index / column values.
pivot_table([values, index, columns, ...])Create a spreadsheet-style pivot table as a DataFrame.
plotalias of
PlotAccessorpop(item)Return item and drop from frame.
pow(other[, axis, level, fill_value])Get Exponential power of dataframe and other, element-wise (binary operator pow).
prod([axis, skipna, numeric_only, min_count])Return the product of the values over the requested axis.
product([axis, skipna, numeric_only, min_count])Return the product of the values over the requested axis.
quantile([q, axis, numeric_only, ...])Return values at the given quantile over requested axis.
query(expr, *[, inplace])Query the columns of a DataFrame with a boolean expression.
radd(other[, axis, level, fill_value])Get Addition of dataframe and other, element-wise (binary operator radd).
rank([axis, method, numeric_only, ...])Compute numerical data ranks (1 through n) along axis.
rdiv(other[, axis, level, fill_value])Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
reindex([labels, index, columns, axis, ...])Conform DataFrame to new index with optional filling logic.
reindex_like(other[, method, copy, limit, ...])Return an object with matching indices as other object.
rename([mapper, index, columns, axis, copy, ...])Rename columns or index labels.
rename_axis([mapper, index, columns, axis, ...])Set the name of the axis for the index or columns.
reorder_levels(order[, axis])Rearrange index levels using input order.
replace([to_replace, value, inplace, limit, ...])Replace values given in to_replace with value.
resample(rule[, axis, closed, label, ...])Resample time-series data.
reset_index([level, drop, inplace, ...])Reset the index, or a level of it.
rfloordiv(other[, axis, level, fill_value])Get Integer division of dataframe and other, element-wise (binary operator rfloordiv).
rmod(other[, axis, level, fill_value])Get Modulo of dataframe and other, element-wise (binary operator rmod).
rmul(other[, axis, level, fill_value])Get Multiplication of dataframe and other, element-wise (binary operator rmul).
rolling(window[, min_periods, center, ...])Provide rolling window calculations.
round([decimals])Round a DataFrame to a variable number of decimal places.
rpow(other[, axis, level, fill_value])Get Exponential power of dataframe and other, element-wise (binary operator rpow).
rsub(other[, axis, level, fill_value])Get Subtraction of dataframe and other, element-wise (binary operator rsub).
rtruediv(other[, axis, level, fill_value])Get Floating division of dataframe and other, element-wise (binary operator rtruediv).
sample([n, frac, replace, weights, ...])Return a random sample of items from an axis of object.
select_dtypes([include, exclude])Return a subset of the DataFrame's columns based on the column dtypes.
sem([axis, skipna, ddof, numeric_only])Return unbiased standard error of the mean over requested axis.
set_attribute(columns, attribute, values)Set an attribute for one or more columns.
set_axis(labels, *[, axis, copy])Assign desired index to given axis.
set_flags(*[, copy, allows_duplicate_labels])Return a new object with updated flags.
set_index(keys, *[, drop, append, inplace, ...])Set the DataFrame index using existing columns.
shift([periods, freq, axis, fill_value, suffix])Shift index by desired number of periods with an optional time freq.
show_attributes([column])Displays all attributes for a specific column or for the entire DataFrame.
skew([axis, skipna, numeric_only])Return unbiased skew over requested axis.
sort_columns(sorted_columns)Sorts columns and attributes of an AttributeDataFrame object.
sort_index(*[, axis, level, ascending, ...])Sort object by labels (along an axis).
sort_values(by, *[, axis, ascending, ...])Sort by the values along either axis.
sparsealias of
SparseFrameAccessorsqueeze([axis])Squeeze 1 dimensional axis objects into scalars.
stack([level, dropna, sort, future_stack])Stack the prescribed level(s) from columns to index.
std([axis, skipna, ddof, numeric_only])Return sample standard deviation over requested axis.
sub(other[, axis, level, fill_value])Get Subtraction of dataframe and other, element-wise (binary operator sub).
subtract(other[, axis, level, fill_value])Get Subtraction of dataframe and other, element-wise (binary operator sub).
sum([axis, skipna, numeric_only, min_count])Return the sum of the values over the requested axis.
swapaxes(axis1, axis2[, copy])Interchange axes and swap values axes appropriately.
swaplevel([i, j, axis])Swap levels i and j in a
MultiIndex.tail([n])Return the last n rows.
take(indices[, axis])Return the elements in the given positional indices along an axis.
to_clipboard(*[, excel, sep])Copy object to the system clipboard.
to_csv([path_or_buf, sep, na_rep, ...])Write object to a comma-separated values (csv) file.
to_dict([orient, into, index])Convert the DataFrame to a dictionary.
to_excel(excel_writer, *[, sheet_name, ...])Write object to an Excel sheet.
to_feather(path, **kwargs)Write a DataFrame to the binary Feather format.
to_gbq(destination_table, *[, project_id, ...])Write a DataFrame to a Google BigQuery table.
to_hdf(path_or_buf, *, key[, mode, ...])Write the contained data to an HDF5 file using HDFStore.
to_html([buf, columns, col_space, header, ...])Render a DataFrame as an HTML table.
to_json([path_or_buf, orient, date_format, ...])Convert the object to a JSON string.
to_latex([buf, columns, header, index, ...])Render object to a LaTeX tabular, longtable, or nested table.
to_markdown([buf, mode, index, storage_options])Print DataFrame in Markdown-friendly format.
to_numpy([dtype, copy, na_value])Convert the DataFrame to a NumPy array.
to_orc([path, engine, index, engine_kwargs])Write a DataFrame to the ORC format.
to_parquet([path, engine, compression, ...])Write a DataFrame to the binary parquet format.
to_period([freq, axis, copy])Convert DataFrame from DatetimeIndex to PeriodIndex.
to_pickle(path, *[, compression, protocol, ...])Pickle (serialize) object to file.
to_records([index, column_dtypes, index_dtypes])Convert DataFrame to a NumPy record array.
to_sql(name, con, *[, schema, if_exists, ...])Write records stored in a DataFrame to a SQL database.
to_stata(path, *[, convert_dates, ...])Export DataFrame object to Stata dta format.
to_string([buf, columns, col_space, header, ...])Render a DataFrame to a console-friendly tabular output.
to_timestamp([freq, how, axis, copy])Cast to DatetimeIndex of timestamps, at beginning of period.
to_xarray()Return an xarray object from the pandas object.
to_xml([path_or_buffer, index, root_name, ...])Render a DataFrame to an XML document.
transform(func[, axis])Call
funcon self producing a DataFrame with the same axis shape as self.transpose(*args[, copy])Transpose index and columns.
truediv(other[, axis, level, fill_value])Get Floating division of dataframe and other, element-wise (binary operator truediv).
truncate([before, after, axis, copy])Truncate a Series or DataFrame before and after some index value.
tz_convert(tz[, axis, level, copy])Convert tz-aware axis to target time zone.
tz_localize(tz[, axis, level, copy, ...])Localize tz-naive index of a Series or DataFrame to target time zone.
unstack([level, fill_value, sort])Pivot a level of the (necessarily hierarchical) index labels.
update(other[, join, overwrite, ...])Modify in place using non-NA values from another DataFrame.
value_counts([subset, normalize, sort, ...])Return a Series containing the frequency of each distinct row in the Dataframe.
var([axis, skipna, ddof, numeric_only])Return unbiased variance over requested axis.
where(cond[, other, inplace, axis, level])Replace values where the condition is False.
xs(key[, axis, level, drop_level])Return cross-section from the Series/DataFrame.
- attributes_to_dataframe(attributes=None)[source]#
Return selected attributes of all columns in the AttributeDataFrame as a new DataFrame.
- Parameters:
attributes (list, optional) – List of attributes to include in the resulting DataFrame. If None, all attributes will be included.
- Returns:
DataFrame where each column corresponds to an original column in the AttributeDataFrame and each row corresponds to an attribute.
- Return type:
Example
df = AttributeDataFrame({‘Temperature’: [22, 23, 21], ‘Pressure’: [101, 102, 100]}) df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Pressure’, ‘units’, ‘Pascal’) df.set_attribute(‘Temperature’, ‘average’, 22) df.set_attribute(‘Pressure’, ‘average’, 101)
# Get only the ‘units’ attribute attribute_df_units = df.attributes_to_dataframe(attributes=[‘units’]) print(attribute_df_units)
# Get both ‘units’ and ‘average’ attributes attribute_df_units_avg = df.attributes_to_dataframe(attributes=[‘units’, ‘average’]) print(attribute_df_units_avg)
- copy_columns(columns=None)[source]#
Extract specified columns into a new AttributeDataFrame, preserving their attributes. If no columns are specified, all columns will be copied.
- Parameters:
columns (list, optional) – List of column names to extract. If None or empty, all columns are extracted.
- Returns:
A new AttributeDataFrame containing the selected columns and their attributes.
- Return type:
Example
# Initialize an AttributeDataFrame df = AttributeDataFrame({‘Temperature’: [22, 23, 21], ‘Pressure’: [101, 102, 100]}) df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Pressure’, ‘units’, ‘Pascal’) df.set_attribute(‘Temperature’, ‘average’, 22) df.set_attribute(‘Pressure’, ‘average’, 101)
# Extract all columns if no columns are specified new_df_all = df.copy_columns() print(new_df_all) print(new_df_all.get_attribute(‘Temperature’, ‘units’)) # Output: Celsius print(new_df_all.get_attribute(‘Pressure’, ‘units’)) # Output: Pascal
- get_attribute(columns, attribute)[source]#
Get a single attribute from an AttributeDataFrame for one or more columns.
- Parameters:
- Returns:
Attribute value(s). Returns a single value if one column is provided, otherwise returns a list of attribute values for multiple columns.
- Return type:
any or list
Examples
df = AttributeDataFrame() df[‘Temperature’] = [22, 23, 21] df[‘Pressure’] = [101, 100, 102] df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’) df.set_attribute(‘Pressure’, ‘units’, ‘Pascal’)
# Single column print(df.get_attribute(‘Temperature’, ‘units’)) # Output: ‘Celsius’
# Multiple columns print(df.get_attribute([‘Temperature’, ‘Pressure’], ‘units’)) # Output: [‘Celsius’, ‘Pascal’]
- get_attribute_dict(attribute_name)[source]#
Creates a dictionary from an attribute where the unique values of the attribute becomes the keys and the items are lists with the column names that match each attribute_name.
- is_attribute(column, attribute)[source]#
Check if a given attribute exists for the specified column.
- match_attribute(attribute, value)[source]#
Returns a list of columns where a specific attribute matches the given value.
- match_attributes(attributes_dict)[source]#
Returns a list of columns where each attribute matches its corresponding value.
- set_attribute(columns, attribute, values)[source]#
Set an attribute for one or more columns.
- Parameters:
- Raises:
ValueError – If the length of columns and values don’t match when values is a list.
Examples
# Single column, single attribute value df.set_attribute(‘Temperature’, ‘units’, ‘Celsius’)
# Multiple columns, same attribute value df.set_attribute([‘Temperature’, ‘Pressure’], ‘source’, ‘Sensor’)
# Multiple columns, different attribute values df.set_attribute([‘Temperature’, ‘Pressure’], ‘units’, [‘Celsius’, ‘Pascal’])
common.Logger module#
common.Masking module#
- class common.Masking.ClusterTab(parent)[source]#
Bases:
objectMethods
Updates color of a cluster
Set cluster color button background after change of selected cluster group
set_default_cluster_colors(style_data, ...)Sets cluster group to default colormap
Executed on update to cluster table.
cluster_label_changed
toggle_cluster_actions
update_table_widget
- cluster_color_callback()[source]#
Updates color of a cluster
Uses
QColorDialogto select new cluster color and then updates plot on change of backroundself.toolButtonClusterColorcolor. Also updatesself.tableWidgetViewGroupscolor associated with selected cluster. The selected cluster is determined byself.spinBoxClusterGroup.value()
- select_cluster_group_callback()[source]#
Set cluster color button background after change of selected cluster group
Sets
MainWindow.toolButtonClusterColorbackground on change ofMainWindow.spinBoxClusterGroup
- set_default_cluster_colors(style_data, cluster_tab, mask=False)[source]#
Sets cluster group to default colormap
Sets the colors in
self.tableWidgetViewGroupsto the default colormap inself.styles['cluster']['Colormap']. Change the default colormap by changing ``self.comboBoxColormap, whenself.comboBoxFieldTypeC.currentText()isCluster.- Returns:
str
- Return type:
hexcolor
- class common.Masking.FilterTab(parent)[source]#
Bases:
objectMethods
Updates filters in
self.parent.datafor given sample_idUpdates
MainWindow.lineEditFMax.valuewhenMainWindow.doubleSpinBoxFMaxQ.valueis changedUpdates
MainWindow.lineEditFMin.valuewhenMainWindow.doubleSpinBoxFMinQ.valueis changedUpdates
MainWindow.doubleSpinBoxFMaxQ.valuewhenMainWindow.lineEditFMax.valueis changedUpdates
self.doubleSpinBoxFMinQ.valuewhenself.lineEditFMin.valueis changedLoads filter names and adds them to the filter presets comboBox
Remove selected rows from filter table.
Opens a dialog to save filter table
update_filter_table([reload])Update data for analysis when fiter table is updated.
update_filter_values(*args, **kwargs)Updates widgets that display the filter bounds for a selected field.
read_filter_table
- apply_field_filters_update_plot()[source]#
Updates filters in
self.parent.datafor given sample_idUpdates the plot once filter values have been update
- callback_doubleSpinBoxFMaxQ()[source]#
Updates
MainWindow.lineEditFMax.valuewhenMainWindow.doubleSpinBoxFMaxQ.valueis changed
- callback_doubleSpinBoxFMinQ()[source]#
Updates
MainWindow.lineEditFMin.valuewhenMainWindow.doubleSpinBoxFMinQ.valueis changed
- callback_lineEditFMax()[source]#
Updates
MainWindow.doubleSpinBoxFMaxQ.valuewhenMainWindow.lineEditFMax.valueis changed
- callback_lineEditFMin()[source]#
Updates
self.doubleSpinBoxFMinQ.valuewhenself.lineEditFMin.valueis changed
- load_filter_tables()[source]#
Loads filter names and adds them to the filter presets comboBox
Looks for saved filter tables (*.fltr) in
resources/filters/directory and adds them toself.comboBoxFilterPresets.
- remove_selected_rows()[source]#
Remove selected rows from filter table.
Removes selected rows from
MainWindow.tableWidgetFilter.
- save_filter_table()[source]#
Opens a dialog to save filter table
Executes on
MainWindow.toolButtonFilterSaveis clicked. The filter is added toMainWindow.tableWidgetFiltersand save into a dictionary to a file with a.fltrextension.
- class common.Masking.MaskDock(parent=None, title='Masking Toolbox')[source]#
Bases:
CustomDockWidget,FieldLogicUIMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)allowedAreas(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Override the default close event to hide the dock widget instead of closing it.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)features(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAreaAllowed(self, area)isEnabled(self)isEnabledTo(self, a0)isFloating(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, event)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllowedAreas(self, areas)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFeatures(self, features)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFloating(self, floating)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTitleBarWidget(self, widget)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWidget(self, widget)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)titleBarWidget(self)toggleViewAction(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])update_data(data)Updates the data
update_field_combobox(parentBox, childBox, ...)Updates comboBoxes with fields for plots or analysis
update_field_type_combobox(comboBox[, ...])Updates field type combobox
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockWidgetFeature
PaintDeviceMetric
RenderFlag
allowedAreasChanged
customContextMenuRequested
destroyed
dockLocationChanged
featuresChanged
objectNameChanged
topLevelChanged
update_tab_widget
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- closeEvent(event)#
Override the default close event to hide the dock widget instead of closing it.
This prevents the widget from being destroyed and allows it to be shown again later via widget.show().
- Parameters:
event (QEvent) – The close event triggered by the user action.
- update_data(data)#
Updates the data
- Parameters:
data (AttributeDataFrame) – New data frame
- update_field_combobox(parentBox, childBox, *args, **kwargs)#
Updates comboBoxes with fields for plots or analysis
Updates lists of fields in comboBoxes that are used to generate plots or used for analysis. Calls
MainWindow.get_field_list()to construct the list.- Parameters:
parentBox (QComboBox, None) – ComboBox used to select field type (‘Analyte’, ‘Analyte (normalized)’, ‘Ratio’, etc.), if None, then ‘Analyte’
childBox (QComboBox) – ComboBox with list of field values
- update_field_type_combobox(comboBox, addNone=False, plot_type='')#
Updates field type combobox
Used to update
MainWindow.comboBoxHistFieldType,MainWindow.comboBoxFilterFieldType,MainWindow.comboBoxFieldTypeX,MainWindow.comboBoxFieldTypeY,MainWindow.comboBoxFieldTypeZ, andMainWindow.comboBoxColorByField
- class common.Masking.MaskObj(initial_value=None)[source]#
Bases:
object- Attributes:
- value
Methods
register_callback
- property value#
- class common.Masking.PolygonTab(parent)[source]#
Bases:
objectMethods
apply_polygon_mask([update_plot])Creates the polygon mask for masking data
Toggles edge detection to the current laser map plot.
Toggle enabled state of polygon actions based on
self.polygon_togglechecked state.update_table_widget(*args, **kwargs)Update the polygon table (PyQt6 version).
View the selected polygon when a selection is made in the table widget .
polygon_state_changed
- apply_polygon_mask(update_plot=True)[source]#
Creates the polygon mask for masking data
Updates
MainWindow.data[sample_id].polygon_maskand ifupdate_plot==True, updatesMainWindow.data[sample_id].mask.- Parameters:
update_plot (bool, optional) – If true, calls
MainWindow.apply_filterswhich also callsMainWindow.update_SV, by default True
- toggle_edge_detection()[source]#
Toggles edge detection to the current laser map plot.
Executes on change of
self.comboBoxEdgeDetectMethodwhenself.toolButtonEdgeDetectis checked.
common.MolecularWeightCalculator module#
Created on Thu Nov 30 15:55:16 2023
@author: a1904121
common.NoteTaking module#
common.Polygon module#
- class common.Polygon.PolygonManager(parent, main_window, logger_options=None, logger_key=None)[source]#
Bases:
objectOperations related to polygon generation and manipulation
Polygons can be used to select or exclude regions of maps for analysis.
- increment_pid()[source]#
creates a new polygon pid for addressing polygon when toolButtonPolyCreate is checked
- plot_polygon_scatter:
- distance_to_line_segment:
- show_polygon_lines:
- update_table_widget:
Methods
Clear all existing polygons from the plot.
distance_to_line_segment(px, py, x1, y1, x2, y2)Computes distance to the line segment of a polygon
extract_scatter_plot_state(scatter)Extract the state of a scatter plot item
Creates a new polygon ID
load_polygons(project_dir, sample_id)Load polygons from a file
plot_existing_polygon(plot[, p_id])Plot the first existing polygon for the current sample ID.
reconstruct_polygon(serializable_polygon)Reconstruct a polygon from a serializable format
recreate_scatter_plot(state)Recreate a scatter plot item from a saved state
save_polygons(project_dir, sample_id)Save polygons to a file
transform_polygon_for_pickling(polygon)Transform the polygon into a serializable format
Update the polygon table
View the selected polygon when a selection is made in the table widget.
add_samples
clear_lines
clear_polygons
plot_polygon_scatter
show_polygon_lines
- distance_to_line_segment(px, py, x1, y1, x2, y2)[source]#
Computes distance to the line segment of a polygon
Determines the minimum distance from a point (px,py) to a line segment defined by the points (x1,y1) and (x2,y2).
- Parameters:
- Returns:
Minimum distance from point to a line
- Return type:
common.PolygonMatplotlib module#
- class common.PolygonMatplotlib.InteractivePolygon(ax, verts)[source]#
Bases:
objectMethods
add_vertex
deselect
move_vertex
remove
remove_vertex
select
- class common.PolygonMatplotlib.PolygonManager(parent, main_window)[source]#
Bases:
objectMethods
Clear all existing polygons from the plot.
Creates a new polygon ID
plot_existing_polygon(canvas[, p_id])Plot the first (or specified) existing polygon for the current sample ID.
start_polygon(canvas)Start polygon drawing for a particular sample_id.
add_samples
deselect_all
disconnect
enable_connections
finish_polygon
initiate_axes
load_polygons
onclick
onkey
onmove
onrelease
save_polygons
common.Regression module#
- class common.Regression.RegressionDock(page_index, parent=None)[source]#
Bases:
CustomDockWidgetRegression analysis page for the toolbox.
This page allows users to select regression methods, configure outlier detection, and tune model parameters. It is designed to be used within a QToolBox in the main application window.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)allowedAreas(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Override the default close event to hide the dock widget instead of closing it.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)features(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAreaAllowed(self, area)isEnabled(self)isEnabledTo(self, a0)isFloating(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, event)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllowedAreas(self, areas)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFeatures(self, features)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFloating(self, floating)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTitleBarWidget(self, widget)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWidget(self, widget)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)titleBarWidget(self)toggleViewAction(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockWidgetFeature
PaintDeviceMetric
RenderFlag
allowedAreasChanged
customContextMenuRequested
destroyed
dockLocationChanged
featuresChanged
objectNameChanged
topLevelChanged
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
common.reSTEdit module#
common.reSTNotes module#
- class common.reSTNotes.NoteOptionsDialog(parent=None)[source]#
Bases:
QDialogOpens when
Notes.action_optionsis triggered.Opens a dialog to change options associated with Notes formatting options.
- Parameters:
parent (Notes, optional) – Notes class used to call this dialog, by default None
Methods
accept(self)acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)done(self, a0)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)exec(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)Returns the options set in the dialog.
grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isSizeGripEnabled(self)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)open(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)reject(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)result(self)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setModal(self, modal)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setResult(self, r)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeGripEnabled(self, a0)setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Updates maximum number of columns option
Updates maximum variance option
Updates notes option dictionary upon accept
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DialogCode
PaintDeviceMetric
RenderFlag
accepted
customContextMenuRequested
destroyed
finished
objectNameChanged
rejected
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.reSTNotes.NotesDock(parent: QMainWindow = None, filename: str | Path | None = None, title: str = 'reST Editor')[source]#
Bases:
CustomDockWidgetA dock that can be used to take notes in ReStructured Text (ReST) including formatted output.
Notes are automatically saved at regular intervals and upon close of the dock. The toolbar includes functions that format selected text into ReST format. There are also options for preformatted output of data and analyses. Tables, and figures can be added, though not viewed in the notes until compiled. With rst2pdf installed, the notes will be compiled into a PDF file. Equations can be added in LaTeX format for nice formatting.
- Parameters:
parent (MainWindow, optional) – Parent UI, by default None
filename (str, optional) – Filename for saving notes, by default None
title (str, optional) – Title for Notes dockwidget, by default ‘Notes’
- Raises:
TypeError – Parent must be an instance of QMainWindow.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)allowedAreas(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, event)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Override the default close event to hide the dock widget instead of closing it.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)features(self)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)initStyleOption(self, option)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAreaAllowed(self, area)isEnabled(self)isEnabledTo(self, a0)isFloating(self)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, event)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAllowedAreas(self, areas)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFeatures(self, features)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFloating(self, floating)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setTitleBarWidget(self, widget)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWidget(self, widget)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)titleBarWidget(self)toggleViewAction(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)widget(self)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockWidgetFeature
PaintDeviceMetric
RenderFlag
allowedAreasChanged
customContextMenuRequested
destroyed
dockLocationChanged
featuresChanged
objectNameChanged
topLevelChanged
visibilityChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.reSTNotes.NotesFormatter[source]#
Bases:
objectMethods
format
format_dict
format_list
format_string
- class common.reSTNotes.NotesMainWindow[source]#
Bases:
QMainWindowA reSTructuredText editor built with PyQt6
This is the main window environment for the reST Notes editor.
- Seealso:
NotesWidget
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)addDockWidget(addDockWidget)addToolBar(-> None)addToolBarBreak(self[, area])adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)centralWidget(self)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, event)contextMenuPolicy(self)corner(self, corner)create(self[, window, initializeWindow, ...])createPopupMenu(self)createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dockOptions(self)dockWidgetArea(self, dockwidget)documentMode(self)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, event)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)iconSize(self)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)insertToolBar(self, before, toolbar)insertToolBarBreak(self, before)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isAnimated(self)isDockNestingEnabled(self)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSeparator(self, pos)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)menuBar(self)menuWidget(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeDockWidget(self, dockwidget)removeEventFilter(self, a0)removeToolBar(self, toolbar)removeToolBarBreak(self, before)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeDocks(self, docks, sizes, orientation)resizeEvent(self, a0)restoreDockWidget(self, dockwidget)restoreGeometry(self, geometry)restoreState(self, state[, version])saveGeometry(self)saveState(self[, version])screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAnimated(self, enabled)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setCentralWidget(self, widget)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCorner(self, corner, area)setCursor(self, a0)setDisabled(self, a0)setDockNestingEnabled(self, enabled)setDockOptions(self, options)setDocumentMode(self, enabled)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setIconSize(self, iconSize)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMenuBar(self, menubar)setMenuWidget(self, menubar)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusBar(self, statusbar)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabPosition(self, areas, tabPosition)setTabShape(self, tabShape)setTabletTracking(self, enable)setToolButtonStyle(self, toolButtonStyle)setToolTip(self, a0)setToolTipDuration(self, msec)setUnifiedTitleAndToolBarOnMac(self, set)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)splitDockWidget(self, after, dockwidget, ...)stackUnder(self, a0)startTimer(self, interval[, timerType])statusBar(self)statusTip(self)style(self)styleSheet(self)tabPosition(self, area)tabShape(self)tabifiedDockWidgets(self, dockwidget)tabifyDockWidget(self, first, second)tabletEvent(self, a0)takeCentralWidget(self)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolBarArea(self, toolbar)toolBarBreak(self, toolbar)toolButtonStyle(self)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unifiedTitleAndToolBarOnMac(self)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)DockOption
PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
iconSizeChanged
objectNameChanged
tabifiedDockWidgetActivated
toolButtonStyleChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.reSTNotes.NotesTab(tab_widget: QTabWidget, filename: str | Path | None = None, title: str = 'reST Editor')[source]#
Bases:
QWidgetMethods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- class common.reSTNotes.NotesWidget(ui=None, filename: str | Path | None = None)[source]#
Bases:
QWidget- Attributes:
info_menu_itemslist[tuple[str, Callable]]: The list of tuples defining the info menu items.
notes_filePath : File name associated with the current sample.
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)add_info_menu_item(label, callback)Add a single menu item to the info menu.
add_menu(menu_items, menu_obj)Adds items to a context menu
add_table_note(matrix[, row_labels, col_labels])Convert matrix to restructured text
adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)close(self)closeEvent(event)Override closeEvent to execute custom logic when the dock widget closes.
colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)format_citation(cursor, key)Formats and appends citation under References section.
format_header(level)Formats a selected line as a header
format_hyperlink(cursor[, key, url])Formats and inserts a hyperlink definition.
format_list(list_type[, list_style])Formats a list in the text, either bulleted or enumerated
format_text(style)Formats the text
frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)insert_image([filename, halign, width, ...])Adds a generic placeholder image to notes
installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)nextInFocusChain(self)normalGeometry(self)objectName(self)Opens the note options dialog.
overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)remove_info_menu_item(label)Remove a single item from the info menu.
render(, sourceRegion, flags, sourceRegion, ...)repaint(...)resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)Saves notes to an *.rst file
screen(self)scroll(scroll)sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)to_rst_table(df)Converts a Pandas DataFrame to a reST table string.
toggleWrap(state)Toggles word wrapping in text editing widget.
Shows/hides the PDF preview browser
toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Compiles the .rst file to HTML and displays it in QWebEngineView.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
connect_widgets
customContextMenuRequested
destroyed
objectNameChanged
print_info
setupUI
update_equation_menu
windowIconChanged
windowIconTextChanged
windowTitleChanged
write_equation
Add a single menu item to the info menu.
If self.action_info is not on the toolbar, then it is added.
- Parameters:
label (str) – The menu label to add
callback (Callable) – The menu callback
Adds items to a context menu
- Parameters:
menu_items (list) – Names of the menu text to add
menu_obj (menu_obj) – context menu object
- add_table_note(matrix, row_labels=None, col_labels=None)[source]#
Convert matrix to restructured text
Adds a table to the note tab, including row lables and column headers.
- format_citation(cursor, key)[source]#
Formats and appends citation under References section.
Creates a citation at the current location, using the selected text as the citation key and then creates an empty referenence in the reference list a the bottom of the document. Creates an empty reference at the current location and an empty citation at the end of the reference list if no text is selected. If no Reference section exists, it will be created.
- Parameters:
cursor (QCursor) – defined by
self.editor.textCursor()key (str) – selected text to be used for the citation key
- format_header(level)[source]#
Formats a selected line as a header
Places a symbol consistent with the heading level below the selected text line.
- Parameters:
level (str) – The header level is determined from a context menu associated with
MainWindow.toolButtonNotesHeading
- format_hyperlink(cursor, key='', url='https://www.example.com')[source]#
Formats and inserts a hyperlink definition.
Ensures the hyperlink is placed above the References section if it exists, or at the end of the document if it doesn’t.
- format_list(list_type, list_style=None)[source]#
Formats a list in the text, either bulleted or enumerated
Formats selected text as bulleted or enumerated in restructured text format.
- format_text(style)[source]#
Formats the text
Formats selected text as bold, italic or literal in restructured text format.
- Parameters:
style (str) – Type of formatting, options include:
bold,italic,literal,subscript,superscript,inline math,display math,citation, andhyperlink
The list of tuples defining the info menu items.
- Each tuple should contain two elements:
label (str): The text label to display in the menu.
callback (Callable): The function to be called when the menu item is triggered.
If self._info_menu_items is empty, then the action is removed from the toolbar.
This property reflects the menu items shown under the “Formatted Info” button.
- insert_image(filename=None, halign='center', width=150, alt_text=None, caption=None)[source]#
Adds a generic placeholder image to notes
Uses the reStructured Text figure format
- property notes_file#
File name associated with the current sample. When set, the current file will be saved before changing files. If the new file name is not None, an autosave timer will be set.
- Type:
Path
Remove a single item from the info menu.
If self._info_menu_items is empty after removing the last menu item, then the action is removed from the toolbar.
- Parameters:
label (str) – Text label of menu item to remove.
- save_notes_file()[source]#
Saves notes to an *.rst file
Autosaves the notes to a file
[sample_id].rst
- to_rst_table(df)[source]#
Converts a Pandas DataFrame to a reST table string.
- Parameters:
df (pandas.DataFrame) – Data table to convert to restructured text
- Returns:
Table in restructred text format
- Return type:
- toggleWrap(state)[source]#
Toggles word wrapping in text editing widget.
- Parameters:
state (bool) – True turns wrapping on
common.reSTRules module#
common.ScheduleTimer module#
- class common.ScheduleTimer.Scheduler(parent=None, callback=None, delay=300)[source]#
Bases:
QObjectScheduler sets a timer once an action is triggered and can be use to delay actions until all desired actions are complete.
- Parameters:
QObject (QObject) – Creates a pyqt object.
- timeout#
Signals when timer has expired.
- Type:
pyqtSignal
Examples
Scheduler for plot updates
self.scheduler = Scheduler(callback=self.*method*)
self.*widget1*.*signal*.connect(self.scheduler.schedule_update) self.*widget2*.*signal*.connect(self.scheduler.schedule_update)
Scheduler with signal
self.scheduler = Scheduler() self.scheduler.timeout.connect(self.on_timeout)
self.*widget*.*signal*.connect(self.scheduler.schedule_update)
Methods
blockSignals(self, b)childEvent(self, a0)children(self)connectNotify(self, signal)customEvent(self, a0)deleteLater(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)event(self, a0)eventFilter(self, a0, a1)findChild(-> QObjectT)findChildren(...)inherits(self, classname)installEventFilter(self, a0)isQuickItemType(self)isSignalConnected(self, signal)isWidgetType(self)isWindowType(self)Check if the timer is currently running.
killTimer(self, id)metaObject(self)moveToThread(self, thread)objectName(self)parent(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
receivers(self, signal)removeEventFilter(self, a0)Restart timer with same delay.
Start or restart the timer.
sender(self)senderSignalIndex(self)setObjectName(self, name)setParent(self, a0)setProperty(self, name, value)set_delay(delay)Set the debounce delay dynamically.
signalsBlocked(self)startTimer(self, interval[, timerType])stop()Stop the timer if it's running.
thread(self)timerEvent(self, a0)tr(sourceText[, disambiguation, n])destroyed
objectNameChanged
timeout
Initializes Scheduler.
Use a scheduler to delay updates when multiple actions are performed.
- Parameters:
parent (QObject, optional) – UI window, by default None
callback (Callable[[], None], optional) – Method executed when timer expires, by default None
delay (int, optional) – Scheduler delay, by default 300
Methods
blockSignals(self, b)childEvent(self, a0)children(self)connectNotify(self, signal)customEvent(self, a0)deleteLater(self)disconnect(-> bool disconnect)disconnectNotify(self, signal)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)event(self, a0)eventFilter(self, a0, a1)findChild(-> QObjectT)findChildren(...)inherits(self, classname)installEventFilter(self, a0)isQuickItemType(self)isSignalConnected(self, signal)isWidgetType(self)isWindowType(self)Check if the timer is currently running.
killTimer(self, id)metaObject(self)moveToThread(self, thread)objectName(self)parent(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
receivers(self, signal)removeEventFilter(self, a0)Restart timer with same delay.
Start or restart the timer.
sender(self)senderSignalIndex(self)setObjectName(self, name)setParent(self, a0)setProperty(self, name, value)set_delay(delay)Set the debounce delay dynamically.
signalsBlocked(self)startTimer(self, interval[, timerType])stop()Stop the timer if it's running.
thread(self)timerEvent(self, a0)tr(sourceText[, disambiguation, n])destroyed
objectNameChanged
timeout
- set_delay(delay)[source]#
Set the debounce delay dynamically.
- Parameters:
delay (int) – Delay, by default 300
- timeout#
int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Type:
pyqtSignal(*types, name
- Type:
str = …, revision
common.SearchTool module#
- class common.SearchTool.SearchWidget(text_edit, parent=None, enable_replace=True, realtime=False)[source]#
Bases:
QWidgetA search and replace toolbar for use with QTextEdit widgets.
Provides inline controls for real-time or return-triggered searching, case sensitivity, regex support, navigation through matches, and optional text replacement.
- Parameters:
text_edit (QTextEdit) – The QTextEdit instance this widget will operate on.
parent (QWidget, optional) – Parent widget, by default None.
enable_replace (bool, optional) – If True, adds replacement input fields and buttons (default is True).
realtime (bool, optional) – If True, triggers search on every keypress; otherwise, search activates on Return (default is False).
Methods
acceptDrops(self)accessibleDescription(self)accessibleName(self)actionEvent(self, a0)actions(self)activateWindow(self)addAction(...)addActions(self, actions)adjustSize(self)autoFillBackground(self)backgroundRole(self)baseSize(self)blockSignals(self, b)changeEvent(self, a0)childAt(...)childEvent(self, a0)children(self)childrenRect(self)childrenRegion(self)clearFocus(self)clearMask(self)Clears the search and replace fields, removes all highlights, and resets internal state (matches, positions, cursor).
close(self)closeEvent(self, a0)colorCount(self)connectNotify(self, signal)contentsMargins(self)contentsRect(self)contextMenuEvent(self, a0)contextMenuPolicy(self)create(self[, window, initializeWindow, ...])createWindowContainer(window[, parent, flags])cursor(self)customEvent(self, a0)deleteLater(self)depth(self)destroy(self[, destroyWindow, destroySubWindows])devType(self)devicePixelRatio(self)devicePixelRatioF(self)devicePixelRatioFScale()disconnect(-> bool disconnect)disconnectNotify(self, signal)dragEnterEvent(self, a0)dragLeaveEvent(self, a0)dragMoveEvent(self, a0)dropEvent(self, a0)dumpObjectInfo(self)dumpObjectTree(self)dynamicPropertyNames(self)effectiveWinId(self)ensurePolished(self)enterEvent(self, event)event(self, a0)eventFilter(self, a0, a1)find(a0)findChild(-> QObjectT)findChildren(...)focusInEvent(self, a0)focusNextChild(self)focusNextPrevChild(self, next)focusOutEvent(self, a0)focusPolicy(self)focusPreviousChild(self)focusProxy(self)focusWidget(self)font(self)fontInfo(self)fontMetrics(self)foregroundRole(self)frameGeometry(self)frameSize(self)geometry(self)grab(self[, rectangle])grabGesture(self, type[, flags])grabKeyboard(self)grabMouse(grabMouse)grabShortcut(self, key[, context])graphicsEffect(self)graphicsProxyWidget(self)hasFocus(self)hasHeightForWidth(self)hasMouseTracking(self)hasTabletTracking(self)height(self)heightForWidth(self, a0)heightMM(self)hide(self)hideEvent(self, a0)Searches the text_edit for the current search term and highlights all matches.
inherits(self, classname)initPainter(self, painter)inputMethodEvent(self, a0)inputMethodHints(self)inputMethodQuery(self, a0)insertAction(self, before, action)insertActions(self, before, actions)installEventFilter(self, a0)isActiveWindow(self)isAncestorOf(self, child)isEnabled(self)isEnabledTo(self, a0)isFullScreen(self)isHidden(self)isLeftToRight(self)isMaximized(self)isMinimized(self)isModal(self)isQuickItemType(self)isRightToLeft(self)isSignalConnected(self, signal)isVisible(self)isVisibleTo(self, a0)isWidgetType(self)isWindow(self)isWindowModified(self)isWindowType(self)keyPressEvent(self, a0)keyReleaseEvent(self, a0)keyboardGrabber()killTimer(self, id)layout(self)layoutDirection(self)leaveEvent(self, a0)locale(self)logicalDpiX(self)logicalDpiY(self)lower(self)mapFrom(-> QPoint)mapFromGlobal(-> QPoint)mapFromParent(-> QPoint)mapTo(-> QPoint)mapToGlobal(-> QPoint)mapToParent(-> QPoint)mask(self)maximumHeight(self)maximumSize(self)maximumWidth(self)metaObject(self)metric(self, a0)minimumHeight(self)minimumSize(self)minimumSizeHint(self)minimumWidth(self)mouseDoubleClickEvent(self, a0)mouseGrabber()mouseMoveEvent(self, a0)mousePressEvent(self, a0)mouseReleaseEvent(self, a0)move(move)moveEvent(self, a0)moveToThread(self, thread)nativeEvent(self, eventType, message)nativeParentWidget(self)navigate_match([forward])Navigates to the next or previous search match in the document.
nextInFocusChain(self)normalGeometry(self)objectName(self)overrideWindowFlags(self, type)overrideWindowState(self, state)paintEngine(self)paintEvent(self, a0)paintingActive(self)palette(self)parent(self)parentWidget(self)physicalDpiX(self)physicalDpiY(self)pos(self)previousInFocusChain(self)property(self, name)pyqtConfigure(...)Each keyword argument is either the name of a Qt property or a Qt signal.
raise_(self)receivers(self, signal)rect(self)releaseKeyboard(self)releaseMouse(self)releaseShortcut(self, id)removeAction(self, action)removeEventFilter(self, a0)render(, sourceRegion, flags, sourceRegion, ...)repaint(...)Replaces all matches in the document with the replacement text.
Replaces the currently selected match in the text_edit with the replacement text.
resize(resize)resizeEvent(self, a0)restoreGeometry(self, geometry)saveGeometry(self)screen(self)scroll(scroll)select_current(length)Moves the cursor to the currently selected match and applies highlight.
sender(self)senderSignalIndex(self)setAcceptDrops(self, on)setAccessibleDescription(self, description)setAccessibleName(self, name)setAttribute(self, attribute[, on])setAutoFillBackground(self, enabled)setBackgroundRole(self, a0)setBaseSize(setBaseSize)setContentsMargins(setContentsMargins)setContextMenuPolicy(self, policy)setCursor(self, a0)setDisabled(self, a0)setEnabled(self, a0)setFixedHeight(self, h)setFixedSize(setFixedSize)setFixedWidth(self, w)setFocus(setFocus)setFocusPolicy(self, policy)setFocusProxy(self, a0)setFont(self, a0)setForegroundRole(self, a0)setGeometry(setGeometry)setGraphicsEffect(self, effect)setHidden(self, hidden)setInputMethodHints(self, hints)setLayout(self, a0)setLayoutDirection(self, direction)setLocale(self, locale)setMask(setMask)setMaximumHeight(self, maxh)setMaximumSize(setMaximumSize)setMaximumWidth(self, maxw)setMinimumHeight(self, minh)setMinimumSize(setMinimumSize)setMinimumWidth(self, minw)setMouseTracking(self, enable)setObjectName(self, name)setPalette(self, a0)setParent(setParent)setProperty(self, name, value)setScreen(self, a0)setShortcutAutoRepeat(self, id[, enabled])setShortcutEnabled(self, id[, enabled])setSizeIncrement(setSizeIncrement)setSizePolicy(setSizePolicy)setStatusTip(self, a0)setStyle(self, a0)setStyleSheet(self, styleSheet)setTabOrder(a0, a1)setTabletTracking(self, enable)setToolTip(self, a0)setToolTipDuration(self, msec)setUpdatesEnabled(self, enable)setVisible(self, visible)setWhatsThis(self, a0)setWindowFilePath(self, filePath)setWindowFlag(self, a0[, on])setWindowFlags(self, type)setWindowIcon(self, icon)setWindowIconText(self, a0)setWindowModality(self, windowModality)setWindowModified(self, a0)setWindowOpacity(self, level)setWindowRole(self, a0)setWindowState(self, state)setWindowTitle(self, a0)sharedPainter(self)show(self)showEvent(self, a0)showFullScreen(self)showMaximized(self)showMinimized(self)showNormal(self)signalsBlocked(self)size(self)sizeHint(self)sizeIncrement(self)sizePolicy(self)stackUnder(self, a0)startTimer(self, interval[, timerType])statusTip(self)style(self)styleSheet(self)tabletEvent(self, a0)testAttribute(self, attribute)thread(self)timerEvent(self, a0)Shows or hides the replace input and buttons based on the toggle state.
toolTip(self)toolTipDuration(self)tr(sourceText[, disambiguation, n])underMouse(self)ungrabGesture(self, type)unsetCursor(self)unsetLayoutDirection(self)unsetLocale(self)update(update update update -> None -> None)updateGeometry(self)updateMicroFocus(self[, query])Updates the display label that shows current match index and total matches.
updatesEnabled(self)visibleRegion(self)whatsThis(self)wheelEvent(self, a0)width(self)widthMM(self)winId(self)window(self)windowFilePath(self)windowFlags(self)windowHandle(self)windowIcon(self)windowIconText(self)windowModality(self)windowOpacity(self)windowRole(self)windowState(self)windowTitle(self)windowType(self)x(self)y(self)PaintDeviceMetric
RenderFlag
customContextMenuRequested
destroyed
objectNameChanged
windowIconChanged
windowIconTextChanged
windowTitleChanged
- clear_search()[source]#
Clears the search and replace fields, removes all highlights, and resets internal state (matches, positions, cursor).
- highlight_matches()[source]#
Searches the text_edit for the current search term and highlights all matches.
Handles both regex and plain text search with optional case sensitivity. Highlights all matches in yellow and the current match in cyan.
Updates the match counter label and prepares match positions for navigation.
Navigates to the next or previous search match in the document.
- Parameters:
forward (bool, optional) – If True, goes to the next match; if False, goes to the previous (default is True).
- replace_all()[source]#
Replaces all matches in the document with the replacement text.
Handles both regex and plain text replacement with optional case sensitivity. Validates regex patterns before execution and warns if invalid.
- replace_current()[source]#
Replaces the currently selected match in the text_edit with the replacement text. After replacing, it re-highlights all matches to update positions.
- select_current(length)[source]#
Moves the cursor to the currently selected match and applies highlight.
- Parameters:
length (int) – The length of the matched text (used to create the cursor range).
common.SortAnalytes module#
common.TableFunctions module#
- class common.TableFunctions.TableFcn(parent=None)[source]#
Bases:
objectCommon table operations class
For moving and deleting rows in QTableWidgets
Methods
delete_row(table)Deletes selected rows in a table
move_row_down(table)Moves a row down one position in a table
move_row_up(table)Moves a row up one position in a table
common.colorfunc module#
- common.colorfunc.is_valid_hex_color(hex_str)[source]#
Validate if a string is a valid hex color in RGB (#RRGGBB) or RGBA (#RRGGBBAA) format.
common.csvdict module#
- common.csvdict.export_dict_to_csv(dictionary, filename)[source]#
Exports a dictionary to csv file
Explorts a simple dictionary that includes a set of keyword associated with lists to a csv. The first column are the dictionary keys and all subsequent columns are values associated with the key.
- common.csvdict.export_filtered_dict_to_csv(dictionary, filename, filter_key, filter_val, selected_keys=None)[source]#
Exports specific items from a dictionary to a CSV file based on conditions.
- Parameters:
dictionary (dict) – The dictionary to filter and export.
filename (str) – Name of file used to save dictionary. Include path in the filename.
filter_key (any) – Key used to filter dictionary
filter_val (any) – Value associated with key to select items to add to the csv
selected_keys (list, optional) – List of keys to include in the export, by default
None
- Raises:
ValueError dictionary must be of type dict. –
common.format module#
- common.format.dynamic_format(value, threshold=10000.0, order=4, toward=None)[source]#
Prepares number for display as str
Formats a number of display as a str, typically in a lineEdit widget.
- Parameters:
value (float) – number to round
threshold (float, optional) – order of magnitude for determining display as floating point or expressing in engineering notation, by default 1e4
order (int, optional) – number of orders to keep, by default 4
toward (int, optional) – direction for rounding,
0for down,1for up, andNonefor nearest, by default None
- Returns:
number formatted as a string
- Return type:
- common.format.inv_logit(x)[source]#
Applies the inverse logit (sigmoid) transformation to a numpy array.
The inverse logit transforms the data from normal space to sigmoid space and is defined as,
\[\operatorname{logit}^{-1}(x) = [1 / (1 + e^{-x})]\]This maps real-valued inputs back to the (0, 1) interval.
- Parameters:
x (numpy.ndarray) – Input array of real values.
- Returns:
numpy.ndarray – Transformed array with values between 0 and 1.
see also: logit
- common.format.inv_symlog(x, linthresh=1.0)[source]#
Inverse symlog transform back to linear space.
Converts a symlog array back to into linear space,
\[\operatorname{symlog}^{-1}(x) = \operatorname{sign} (x) \lambda (10^{|x|} - 1)\]where \(\lambda\) is the linear threshold used to control the region near zero where the data behave linearly.
- Parameters:
x (numpy.ndarray) – the array of values to transform
linear_threshold (float, optional) – linear threshold, often chosen as the mean, median, or standard deviation of the data or simply, by default 1.0
- Returns:
numpy.ndarray – transformed values of x back to linear space
see also: symlog
- common.format.logit(x, eps=1e-08)[source]#
Applies the logit (log-odds) transformation to a numpy array.
The logit function is defined as,
\[\operatorname{logit}(x) = \log [x / (1 - x)]\]Values of x must be in the open interval (0, 1). To avoid division by zero or log of zero, values are clipped to [eps, 1 - eps].
- Parameters:
x (numpy.ndarray) – Input array with values between 0 and 1.
eps (float, optional) – Small value used to clip inputs away from 0 and 1 to prevent numerical issues. Default is 1e-8.
- Returns:
numpy.ndarray – Transformed array with log-odds values.
see also: inv_logit
- common.format.oround(val, order=2, toward=None)[source]#
Rounds a single of value to n digits
Round a single number to the first n digits.
- common.format.oround_matrix(val, order=2, toward=None)[source]#
Rounds a matrix of values to n digits
Rounds all numbers in a matrix to the first n digits.
- common.format.parse_isotope(field: str)[source]#
Converts an isotope into a symbol and mass.
Separates an analyte field with a symbol-mass name to its separate parts. For example, 27Al returns Al (symbol), 27 (mass).
- Parameters:
field (str) – Field name to separate into symbol and mass.
- Returns:
symbol (str) – Returns the element symbol.
mass (int) – Returns the isotope mass.
- common.format.symlog(x, linear_threshold=1.0)[source]#
Transforms data from linear to symlog space
The advantage of a symlog transformation is that produces a log-like distribution for most values, but can be used on negative and zero values as well as positive values, preserves symmetry about 0.
A symlog transformation is
\[\operatorname{symlog} (x) = \operatorname{sign} (x) \log_{10} (1 + |x|/\lambda),\]where \(\lambda\) is the linear threshold, region where the transformation is approximately linear.
- Parameters:
x (numpy.ndarray) – the array of values to transform
linear_threshold (float, optional) – linear threshold, often chosen as the mean, median, or standard deviation of the data or simply, by default 1.0
- Returns:
transformed values of x into symlog space
- Return type:
common.gausscensor module#
- common.gausscensor.gausscensor(x, scale='linear', q=[0.05, 0.25, 0.5, 0.75, 0.95], a=0.375)[source]#
Estimates statistical parameters when there are censored data.
Estimates the mean, and standard deviation when there are censored data. This method is specifically for use with compositional data that should be positive only. Values of zero indicate a left censored value, but no detection limit has been reported. Negative values indicate left censored values with absolute value being the detection limit.
Reference: Michael, J.R., and W.R. Schucany, 1986, Analysis of Data from Censored Samples, in Goodness-of-Fit-Techniques, eISBN: 9780203753064
- Parameters:
x (numpy.ndarray) – Array of data with left-censored values, zero indicates unknown detection limit, absolute value of negative value indicates known detection limit.
scale (str, optional) – Options include
linear,logandlog10, by default ‘linear’q (list, optional) – A list of percentiles to estimate the quantile, by default [0.05, 0.25, 0.5, 0.75, 0.95]
a (shape parameter, optional) – Determined by the type of distribution, by default 3/8
- Returns:
Returns a dictionary with statistical estimates for scale parameters (mu and sigma) and uncertainty of the mean (sigma_mu) and an estimated root-mean-square (rms) misfit.
- Return type:
common.outliers module#
- common.outliers.chauvenet_criterion(array, threshold=1)[source]#
Apply Chauvenet’s criterion for outlier detection.
- Parameters:
array (numpy.ndarray) – The dataset to analyze.
threshold (float) – The probability threshold multiplier for rejecting outliers (default is 1, stricter is higher).
- Returns:
Boolean mask, with outliers identified as false.
- Return type:
Source: https://en.wikipedia.org/wiki/Chauvenet%27s_criterion
- common.outliers.peirce_dev(N, n, m) float[source]#
Peirce’s criterion
Returns the squared threshold error deviation for outlier identification using Peirce’s criterion based on Gould’s methodology.
common.plot_spider module#
Created on Wed Nov 22 16:56:39 2023
@author: Shavin Kaluthantri
- common.plot_spider.logax(ax, lim, axis='y', label='', tick_label_rotation=0)[source]#
Produces log-axes limits and labels.
Parameters: ax (matplotlib.axes.Axes): The axes to modify. lim (list): The log10 values of the axes limits. axis (str): ‘x’ or ‘y’ to add ticks to x- or y-axis, default is ‘y’. label (str): Label for the axis. tick_label_rotation (float): Angle of text rotation, default is 0.
common.radar module#
- class common.radar.Radar(ax, data, fields, fieldlabels=None, group_field='', groups=None, quantiles=None, axes_interval=5)[source]#
Bases:
objectPrepares a DataFrame for a radar plot.
_extended_summary_
- Parameters:
ax (matplotlib.axes) – Axis object
data (pandas.DataFrame) – Data used for averaging.
fields (list) – list of fields in data used to define the axes.
fieldlabels (list) – Labels associated with fields. If
None,fieldlabelsis set tofields, by default Nonegroup_field (str, optional) – _description_, by default ‘’
groups (_type_, optional) – _description_, by default None
quantiles (_type_, optional) – _description_, by default None
axes_interval (int, optional) – _description_, by default 5
- Raises:
ValueError – _description_
Methods
Normalizes the data in self.vals for radar plot visualization.
plot([cmap])_summary_
common.radar_factory module#
common.rotated module#
common.scalebar module#
- class common.scalebar.scalebar(width, pixel_width, units=None, location='southeast', orientation='horizontal', color=[0, 0, 0], ax=None)[source]#
Bases:
objectProduces a scalebar on x,y maps
Produce a scalebar on (x,y) maps, just inside one corner of the map.
- create : Add scalebar to axes
- Parameters:
width (float) – Absolute width of the scalebar in units
pixel_width (float) – Pixel dimensions in the orientation direction. Since
matplotlib.pyplot.imshowdoes not allow for x, y values, the pixel_width is important for converting between absolute units and image units.units (str, optional) – Units to include on plot e.g., ‘mm’, by default None
location (str, optional) – Scalebar location, defined by corner. Options include
'northeast','northwest','southeast', and'southwest', by default'southeast'orientation (str, optional) – Scalebar orientation, either
'horizontal'or'vertical', by default'horizontal'color (list, optional) – Color of scalebar in matplotlib color spec., by default [0, 0, 0]
ax (matplotlib.axes, optional) – Axis to add scalebar onto, by default None
- Raises:
ValueError – ‘Unknown location, choose from [northeast, northwest, southwest, southeast].’
ValueError – ‘Unknown location, choose from [horizontal, vertical].’
Methods
create()_summary_
common.ternary_colormap module#
common.ternary_plot module#
Created on Thu Nov 2 20:43:59 2023
@author: Shavin Kaluthantri and Derrick Hasterok
- class common.ternary_plot.ternary(ax, labels=None, plot_type='scatter', style='ternary', grid_spacing=None, tick_spacing=None)[source]#
Bases:
objectTernary plotting class, produces ternary axes and creates various plot types.
The ternary plotting class can be used to produce scatter plots, heatmaps, or produce ternary coloring maps that can be used to color points
- Parameters:
ax (matplotlib.axes) – Axes object for displaying ternary diagram
plot_type (str, optional) – Defaults to ‘scatter’
style (str, optional) – Ternary plot style, ternary (triangle) or quaternary (diamond)
grid_spacing (float, optional) – grid spacing (0,1), Defaults to None
tick_spacing (float, optional) – tick spacing (0,1), Defaults to None
- Raises:
ValueError – ‘Bins must be a positive integer’, requires bin values are positive.
ValueError – ‘Number of vertices must be 3 or 4’, 3 verticies are required for ternary diagram and 4 for quaternary (double ternary).
ValueError – ‘Tick spacing must be between 0 and 1’
ValueError – “Style must be ‘ternary’ or ‘quaternary’”
Methods
cplane(a, b, c, ca, cb, cc, p, cp)Determines colors for a set of points (a,b,c) within a ternary
cplanexy(xd, yd, xp, yp, cp, x1, y1, cv1, ...)Fits a plane to (x,y,color) data
hexagon(bins)Creates hexagonal bins within a ternary
tern2xy(a, b, c)Converts ternary (a,b,c) points to cartesian (x,y) coordinates.
ternaxes([labels])Set up ternary plot axes with optional labeling for a quaternary plot.
terncolor(a, b, c[, ca, cb, cc, p, cp])Computes colors using a ternary colormap
terngrid([spacing])Adds ternary grid lines to ternary axes.
ternhex([a, b, c, val, hexbin_df, ...])Creates a heatmap from a set of hexgonal bins
ternscatter(a, b, c[, d, size, cmap, color, ...])Scatter plot data on ternary axes.
ternticks([spacing])Adds ternary tick marks to ternary axes.
xy2tern(x, y)Converts cartesian (x,y) points to ternary (a,b,c) coordinates.
- cplane(a, b, c, ca, cb, cc, p, cp)[source]#
Determines colors for a set of points (a,b,c) within a ternary
Given four colors, one for each vertex of a ternary and a fourth at an arbitrary location within the triangle, the function computes a gradient for any set of points within the triangle.
- Parameters:
a (np.array) – Ternary coordinates of data points where color is computed
b (np.array) – Ternary coordinates of data points where color is computed
c (np.array) – Ternary coordinates of data points where color is computed
ca (np.array) – Colors set at verticies
cb (np.array) – Colors set at verticies
cc (np.array) – Colors set at verticies
p (np.array) – Location of interior point where an additional color can be defined (i.e., cp)
cp (np.array) – Color at p, default is [], which will use average of colors
- Returns:
cval, colors at (a,b,c)
- Return type:
np.array
- cplanexy(xd, yd, xp, yp, cp, x1, y1, cv1, x2, y2, cv2)[source]#
Fits a plane to (x,y,color) data
Fits a plane using three points in (x,y,color) space and then interpolates the color of know points.
- Parameters:
xd (np.array) – Cartesian coordinates for data within ternary
yd (np.array) – Cartesian coordinates for data within ternary
xp (float) – Coordinates of point within ternary
yp (float) – Coordinates of point within ternary
cp (np.array) – color at point within ternary
x1 (float) – Coordinates at ternary vertex 1
y1 (float) – Coordinates at ternary vertex 1
cv1 (np.array) – Color at vertex 1
x2 (float) – Coordinates at ternary vertex 2
y2 (float) – Coordinates at ternary vertex 2
cv2 (np.array) – Color at vertex 2
- Returns:
cval, colors at (a,b,c)
- Return type:
np.array
- tern2xy(a, b, c)[source]#
Converts ternary (a,b,c) points to cartesian (x,y) coordinates.
The order of the axes are a (top), b (left), and c (right), where the Cartesian origin is defined at the midpoint between b and c.
- Parameters:
a (np.array) – Top, left and right vertex coordinates, respectively
b (np.array) – Top, left and right vertex coordinates, respectively
c (np.array) – Top, left and right vertex coordinates, respectively
- ternaxes(labels=None)[source]#
Set up ternary plot axes with optional labeling for a quaternary plot.
- terncolor(a, b, c, ca=[1, 1, 0], cb=[0.3, 0.73, 0.1], cc=[0, 0, 0.15], p=[0.3333333333333333, 0.3333333333333333, 0.3333333333333333], cp=[])[source]#
Computes colors using a ternary colormap
Given four colors, one for each vertex of a ternary and a fourth at an arbitrary location within the triangle, the function computes a gradient for any set of points within the triangle. Default color scheme is yellow-green-navy.
- a, b, cnp.array
Ternary coordinates of data points where color is to be computed
- ca, cb, ccnp.array, optional
Colors set at verticies, by defaults ca=[0.3,0.73,0.1], cb=[0,0,0.15], cc=[1/3,1/3,1/3]
- pnp.array, optional
Location of interior point where an additional color can be defined (i.e., cp)
- cpnp.array, optional
Color at p, default is [], which will use average of colors
- Returns:
cval, colors at (a,b,c)
- Return type:
np.array
- terngrid(spacing=0.1)[source]#
Adds ternary grid lines to ternary axes.
Updates current ternary axes with tick marks.
- ternhex(a=None, b=None, c=None, val=None, hexbin_df=None, plotfield=None, bins=10, cmap=None, orientation='horizontal', norm=None)[source]#
Creates a heatmap from a set of hexgonal bins
- Parameters:
a (np.array, optional) – Locations of points within a ternary system, not needed if hexbin_df is provided, by default None
b (np.array, optional) – Locations of points within a ternary system, not needed if hexbin_df is provided, by default None
c (np.array, optional) – Locations of points within a ternary system, not needed if hexbin_df is provided, by default None
val (np.array, optional) – A fourth-dimension, compute statistics of val within each hexbin, not supplied if hexbin_df is provided, by default None
hexbin_df (pandas.DataFrame, optional) – A data frame containing statistics from a previously call to ternhex, in this case, do not supply a, b, c, or val, by default None
plotfield (str, optional) – Field in hexbin_df to plot, values may include [‘n’, ‘mean’, ‘median’, ‘std’]. If None, no plot is produced, but hexbin_df is returned, by defaults None
bins (int, optional) – Resolution factor (bins+1 hexagons across bottom axis), by default 10
cmap (matplotlib.colors.Colormap) – colormap, by defaults None
norm (matplotlib.colors.Norm, optional) – Normalize colormap
orientation (str, optional) – orientation of colormap,
horizontalorvertical, by default horizontal
- ternscatter(a, b, c, d=None, size=36, cmap=None, color=None, categories=None, labels=False, alpha=1, marker='o', edgecolors='none', ax=None, orientation='horizontal', norm=None)[source]#
Scatter plot data on ternary axes.
Ternary scatter plot, ternscatter() uses many of the same parameters as matplotlib scatter.
- Parameters:
a (np.array) – Coordinate associated with top, left and right vertices, respectively
b (np.array) – Coordinate associated with top, left and right vertices, respectively
c (np.array) – Coordinate associated with top, left and right vertices, respectively
d (np.array, optional) – Coordinate associated with bottom vertex of quaternary (diamond) plot, by default None
size (float, optional) – Marker size (in points), by defaults 36
cmap (matplotlib.Colormap, optional) – Colormap if points are to be colored by value, by defaults None
color (optional) – Color of markers, defaults to None
norm (matplotlib.colors.norm) – Normalize colormap
edgecolors (optional) – By default None
marker (str, optional) – Symbol used for plotting, Defaults to ‘o’
categories (optional) – Values used to determine color for plotting. If categries is a set of discrete categories, add
labels=Trueto display a legend with values for labels, by default Nonelabels (bool, optional) – Indicates categories are lables
- Returns:
Scatter plot object, legend (if applicable)
- Return type:
matplotlib.scatter_object
- ternticks(spacing=0.1)[source]#
Adds ternary tick marks to ternary axes.
Updates current ternary axes with tick marks.
- Parameters:
spacing (float) – Distance between tick marks.
- xy2tern(x, y)[source]#
Converts cartesian (x,y) points to ternary (a,b,c) coordinates.
The order of the axes are a (top), b (left), and c (right), where the Cartesian origin is defined at the midpoint between b and c.
- Parameters:
x (np.array) – Cartesian, x and y coordinates
y (np.array) – Cartesian, x and y coordinates
common.varfunc module#
- class common.varfunc.ObservableDict(*args, callback=None, **kwargs)[source]#
Bases:
dictMethods
clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(key[, default])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem(/)Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()